Notices

Overclockers Forums > Software > Internet, Networking, and Security
Internet, Networking, and Security Networking and Viruses/Malware trouble. Get the answers here.
Forum Jump

Apache not following symlinks?

Post Reply New Thread Subscribe Search this Thread
 
 
Thread Tools
Old 10-14-07, 06:20 PM Thread Starter   #1
bLack0ut
Member

 
bLack0ut's Avatar 

Join Date: Dec 2004

 
Apache not following symlinks?


I have my apache webserver to chroot into /var/www/htdocs as a home directory. I added a symlink "share" in that directory that links to /files, a completely separate mounted filesystem. When I browse the mapped network drive, it follows the symlink alright, but when I attempt to browse using http, i.e. mysite.com/share, it gives me a 404 error and the log says the file doesn't exist, even though it does(as a symlink).

I have already made sure /var/www/htdocs has followsymlinks on, so I don't know what the problem is.

EDIT: If the mods think this in the wrong spot, feel free to move it.

__________________
Heat
bLack0ut is offline   QUOTE Thanks
Old 10-15-07, 07:43 PM Thread Starter   #2
bLack0ut
Member

 
bLack0ut's Avatar 

Join Date: Dec 2004

 
bump, can anyone help?

__________________
Heat
bLack0ut is offline   QUOTE Thanks
Old 10-15-07, 10:32 PM   #3
ShadowPho
Member

 
ShadowPho's Avatar 

Join Date: Jun 2005
Location: I am in your stack, SUBbing your registers!

 
Now, let's think about what the symlink adds to the system.

As of now, what is the point of Apache2? To server files requested to people but make sure that people only get files that they are allowed to get. If you add the symlink into the equation, then they might gain access to some bad places.

The first link on google (apache + symlink) gave the solution. I have never tried it myself, but here is what it says: (from google search)
Quote:
08-30-2003, 10:54 PM
Assuming the default apache install, you'll have to find the file /etc/httpd/httpd.conf and modify it (as root). Doing a:
sudo pico /etc/httpd/httpd.conf
should work nicely

Find the <Directory /> tag (about 39% of the way through the file, methinks) and add the line
Options FollowSymLinks
so that the code block looks like this:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
Then you'll have to restart apache from the System Preferences place (go to sharing and turn off/back on the Personal Web Sharing).

Hopefully this'll work for you :-)

Also, be sure to take care that the *target* of the symlink, and any directory containing it, has read (and execute, for directory) permissions for "other." I won't tell you how long it took before I realized the default OS X permissions for the ~/Documents folder was 700 :-)

__________________
"Take only that which you can give"
Need Help? IM me! I want to help the OC community!

MainComputer:
E6400@2.69-4.0 gig RAM-8800GT
ASUS P5N-E SLI

ShadowPho is offline Heatware Profile   QUOTE Thanks
Old 10-16-07, 02:26 PM Thread Starter   #4
bLack0ut
Member

 
bLack0ut's Avatar 

Join Date: Dec 2004

 
Yep that's actually the default Apache config, so I've already done that the symlinks change. I've also checked permissions.

Let me elaborate on my setup:

On my server, apache serves web documents from /var/www/htdocs. Within htdocs all I have is an index.php page atm.

On that same server, I have some files mounted under /share. I want apache to be able to serve those files. Thus, I did

Code:
cd /var/www/htdocs
ln -s /share sharez
This created a symlink within the htdocs folder, which I could see when I browsed the samba share mapped network drive. It worked fine while browsing with explorer.

Then I attempted to connect to my server (remotely, not locally) through port 80, and the index page worked fine. However, although www.mysite.com worked fine, www.mysite.com/sharez did not resolve. I have both directory browsing and follow symlinks on.

Does apache need some special permissions to serve files from a different mount? I feel like its more a problem with URLs than symlinks themselves, but I'm not really sure.


EDIT: Btw, its on OpenBSD.

__________________
Heat
bLack0ut is offline   QUOTE Thanks
Old 10-18-07, 08:07 AM Thread Starter   #5
bLack0ut
Member

 
bLack0ut's Avatar 

Join Date: Dec 2004

 
bump, anyone know this?

__________________
Heat
bLack0ut is offline   QUOTE Thanks
Old 10-21-07, 12:19 AM Thread Starter   #6
bLack0ut
Member

 
bLack0ut's Avatar 

Join Date: Dec 2004

 
Ok, I'm an idiot for not realizing that Apache has a built in safety feature that disallows access to anything outside of Document Root. Basically, it read my symlinks as null since they pointed outside of the document root.

__________________
Heat
bLack0ut is offline   QUOTE Thanks

Post Reply New Thread Subscribe


Overclockers Forums > Software > Internet, Networking, and Security
Internet, Networking, and Security Networking and Viruses/Malware trouble. Get the answers here.
Forum Jump

Thread Tools Search this Thread
Search this Thread:

Advanced Search


Mobile Skin
All times are GMT -5. The time now is 01:40 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
You can add these icons by updating your profile information to include your Heatware ID, Benching Profile ID or your Folding/SETI profile ID. Edit your profile!
X

Welcome to Overclockers.com

Create your username to jump into the discussion!

New members like you have made this the best community on the Internet since 1998!


(4 digit year)

Why Join Us?

  • Share experience
  • Max out your hardware
  • Best forum members anywhere
  • Customized forum experience

Already a member?