Solved

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

Posted on 2011-02-15
7
269 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ignore other .htaccess 2 59
number in printf 13 32
CentOS 7 Linux for HP DL380 G4 32Bits 7 47
Apache module 5 47
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

829 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