Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-15
7
Medium Priority
?
287 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
Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

609 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