Solved

softlinks didn't work when browsing the DocumentRoot directory on Apache

Posted on 2011-02-15
7
276 Views
Last Modified: 2012-05-11
Hello Experts,

I am using Redhat linux RHEL 5.3 OS with Apache running on it, in httpd.conf the DocumentRoot is /var/www/html, i created directory called 'pub' under the DocumentRoot i.e. /var/www/html/pub.
Any soft-links( to another directory)  created under /var/www/html/pub is not listed when access via browser. How can i access the soft links directories from web browser client.
0
Comment
Question by:sudhirgoogle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:DangerousJeff
ID: 34895564
In your configuration you'll need to set up a <directory> section and specify an option to allow following symlinks.
Similar could be done with .htaccess file.

Something like

<Directory /var/www/html/pub>
    Options Indexes FollowSymLinks
</Directory>

Open in new window


http://httpd.apache.org/docs/2.0/mod/core.html#directory
http://httpd.apache.org/docs/2.0/mod/core.html#options
0
 
LVL 1

Author Comment

by:sudhirgoogle
ID: 34895740
I added above entries in httpd.conf file, and restarted httpd service,  but no luck.

will hard-link and soft-link both will work ??

which one i should use ?? hard-link or soft-link ??

i created using ' ln -s' command, is that correct or do i need to use 'ln -d  ' Please suggest.
0
 
LVL 4

Expert Comment

by:DangerousJeff
ID: 34895901
Hmm, soft link should be fine
Try this (some may already exist):
<Directory "/var/www/html">
options Indexes Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

<Directory "/var/www/html/pub">
options +FollowSymLinks
</Directory>

Open in new window


If still not working after a restart, please post full configuration file, check your apache error log file
May be a permission issue with the directories you are trying to access not being accessible by the "apache" user, assuming that is who its running as
0
Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

 
LVL 1

Author Comment

by:sudhirgoogle
ID: 34904418
I tried as per your suggestion but still not working. i am here attaching the httpd conf file.
httpd.conf.txt
0
 
LVL 4

Expert Comment

by:DangerousJeff
ID: 34905078
you did check your apache error logs yes?
try making a test directory you are symlinking to be owned by apache
obviously remember that apache is case sensitive

I assume the issue is these links aren't showing up the index? Does anything show up?
0
 
LVL 1

Accepted Solution

by:
sudhirgoogle earned 0 total points
ID: 35144961
I resolved the problem. It was issue with selinux, i used restorecon command to set the selinux context for the softlink directory and it worked like a charm.
0
 
LVL 1

Author Closing Comment

by:sudhirgoogle
ID: 37452977
I found solution myself. Thank for your reponses.
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question