LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Using "public_html" as a symlink (https://www.linuxquestions.org/questions/linux-server-73/using-public_html-as-a-symlink-610715/)

rnturn 01-02-2008 10:36 PM

Using "public_html" as a symlink
 
I have several virtual hosts set up an Apache 2.2.3 server. A few of the virtual sites are running software that I used to (when using previous Apache 2.x releases) install in a directory named "package-v2.0.1", "package-v2.0.2", etc. I would then define a symlink pointing to the subdirectory holding the "production" version of the software once it had been tested. Redefining the symlink was a really easy means of reverting to an earlier version if any MFUs were found.

A quick-n-dirty picture of the directory structure is:
Code:

/var
  +--web
      +--httpd/public_html          (directory)
      +--vhosts
          +--vhost-1.com
          |    +--public_html      (directory)
          +--vhost-2.com
              +--package-v2.0.1    (directory)
              +--package-v2.0.2    (directory)
              +--public_html      (symlink to v2.0.2)

Well that doesn't seem to work any more under Apache 2.2.3. I only seem to be able to find/display the files associated with a virtual web server if "public_html" is an actual directory.

Pointing a browser at the main server server (in "/var/web/httpd/public_html") or "vhost-1.com" works fine.
But... when I try to go to "vhost-2.com", I'm getting the default "Hey the Apache installation works!" web page under the main server's directory. It doesn't even place any nastygrams in the vhost-2 access and/or error logs. I DO get the message
Code:

Symbolic link not allowed or link target not accessible:
 /var/web/vhosts/vhost-2/public_html

in the general error_log.

I've made changes to mod_userdir.conf and that hasn't panned out. (OK, that was a crap shoot, that one.) "apache2ctl -t" tells me that the syntax is OK. (Yah, great.)

Does anyone know which file I might be able to tweak to get Apache to recognize public_html as a symlink? (To get past that "Symbolic link not allowed" error.) Or is my old method of switching software versions via symlinks not allowed under the later Apache releases? (Security hole?)

TIA

--
rt

jiml8 01-02-2008 11:09 PM

I would be looking for a permissions problem. The real directories and the files in them have to be readable by Apache, which means that Apache has to have permission to read them.

paulsm4 01-02-2008 11:22 PM

Have you tried the "FollowSymLinks" option (it's OFF by default...)?

rnturn 01-04-2008 09:15 AM

Quote:

Originally Posted by jiml8 (Post 3009269)
I would be looking for a permissions problem. The real directories and the files in them have to be readable by Apache, which means that Apache has to have permission to read them.

I'm pretty sure that's not it. I did check that last night: the permissions on all the virtual hosts' "home" directories and the subdirectories -- either "public_html" or the target of a "public_html" symlink -- are all "755". They're all owned by the "web" group and the httpd user that runs the web server is a member of that group.

I'm not where I can check anything else right now but I'll double check tonight that there's not some read problem by "su"ing to httpd and verifying that I can read directories and files for the virtual web services.

Thanks...

--
rt

rnturn 01-04-2008 09:54 AM

Quote:

Originally Posted by paulsm4 (Post 3009282)
Have you tried the "FollowSymLinks" option (it's OFF by default...)?

I think you're right about it being some symlink-related option.

I seem to recall (not where I can get at the web server just now) that I had at one point put a Directory directive (for "/var/web/vhosts/vhost-2.com") in one of the files in the vhosts.d directory and didn't see anything change. I didn't include the FollowSymLinks option, though, but did use the SymLinksifOwnerMatch (sp?) option.

I'll get a chance to look deeper into this tonight.

Thanks...

--
rt


All times are GMT -5. The time now is 04:57 PM.