LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-23-2010, 10:21 AM   #1
RageKat
LQ Newbie
 
Registered: Jun 2010
Posts: 5

Rep: Reputation: 0
Fighting Apache to make it work with symlinks


I'm having a real problem getting Apache to allow a symlink on a particular folder. The symlink is at /var/www/html/images and it points to /home/foo/images.

Here is the relevant section to my httpd.conf
Quote:
<Directory />
Options +FollowSymLinks
AllowOverride None
</Directory>
<Directory "/home/foo/images">
# ALSO ATTEMPTED: <Directory "/var/www/html/images">
Options +Indexes +FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>
I am using Centos 5 with everything up to date (according to their repositories). I read a former article on this site about the possibility of SELinux interfering, and I'd like to say now that it's not the reason for my issues as it's turned off.

Visiting http://<ip>/images renders a 403 error. Here is what the error_log has to say about it:

Quote:
[Tue Jun 22 16:26:43 2010] [error] [client 192.168.0.94] Symbolic link not allowed or link target not accessible: /var/www/html/images
I'm sort of at my wit's end on this one. I even copied over an httpd.conf file from a server that does work and replaced the paths in httpd.conf but even this didn't work. Any help would be appreciated.
 
Old 06-23-2010, 11:08 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
That is not the correct way to use httpd.conf

All the Options can be entered without +,
+ is for .htaccess override files.

You shouldn't need any other config in httpd.conf to use a symlink if the default directory config is as follows :
Code:
<Directory />
    Options FollowSymLinks
    AllowOverride None
</Directory>
Just create the symlink as normal (i.e. as the same user as owns the site, or make the linked to directory and files readable by all), then access images as normal.

If you want to allow indexing use .htaccess
Code:
Options +Indexes

Last edited by smoker; 06-23-2010 at 11:16 AM.
 
Old 06-23-2010, 11:21 AM   #3
RageKat
LQ Newbie
 
Registered: Jun 2010
Posts: 5

Original Poster
Rep: Reputation: 0
This actually isn't helping for some reason. I changed the Directories as you said.

As for permissions... httpd is running as root and everything in /home/foo/images is chmod'd as 777, so I'm pretty sure it's not that.
 
Old 06-23-2010, 11:41 AM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Did you restart apache ?

And running httpd as root is a recipe for disaster.
 
Old 06-23-2010, 11:45 AM   #5
RageKat
LQ Newbie
 
Registered: Jun 2010
Posts: 5

Original Poster
Rep: Reputation: 0
I did restart it, yes.

And I know that it's a recipe for disaster, but I'm doing so until I fix this one issue. As long as it's running as root I can be pretty sure that it's not a permissions issue. After it's working, i can change it back. It's not exactly a public server either so I should be fine for a while.

EDIT: Okay, I was wrong. It's in fact still running as 'apache' but the folder /home/foo/images remains, as all of its contents, chmod'd to 777.

Last edited by RageKat; 06-23-2010 at 11:50 AM.
 
Old 06-23-2010, 11:52 AM   #6
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
According to the error you posted, /var/www/html/images appears to be the target.

How did you create the symlink ?

The best way to do it is to change directory to /var/www/html/ then do
Code:
ln -s /home/foo/images
 
Old 06-23-2010, 02:51 PM   #7
sunnydrake
Member
 
Registered: Jul 2009
Location: Kiev,Ukraine
Distribution: Ubuntu,Slax,RedHat
Posts: 289
Blog Entries: 1

Rep: Reputation: 61
"sudo chmod -R 777 /var/www/html/images" if not workin try to make dir in / and symlink to it(could be parent dir permission).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Make ls ignore symlinks Creep Linux - Software 4 06-11-2020 08:36 PM
Cant make symlinks work? What to do? linus72 Debian 24 09-16-2009 10:06 AM
Fighting to make it in Linux world ki77en Linux - Newbie 9 01-28-2005 06:22 PM
make symlinks jazernorth Linux From Scratch 1 03-20-2004 12:22 PM
'make symlinks' doesn't work rdaves@earthlink.net Linux - Software 1 05-30-2001 06:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration