1

I've installed Nginx + FPM-PHP under Debian and ArchLinux. Both are working fine. However, I can't figure out how to get the PHP part to follow symlinks. I've also tried with Lighttpd, but to no avail.

Here is what I want to do:

  1. Root directory configured as usual: /srv/http
  2. Symlinks from each project to /srv/http (example: /home/user/projects/site1 to /srv/http/@site1), in such a manner that to test a local development, I just need to add the name of the site to the URL: "http://localhost/site1/xyz" or "http://localhost/site2/abc", etc;

I can make it work (after fixing permissions) with html and other static files, but whenever there is a PHP script, I get the famous "Primary script unknown" error. Inside the "real root" directory (/srv/http) there is not such an error. But when I tried to copy a subdirectory to another location (ie /home/user/projects/xyz) and symlink it to /srv/http/, I get that error.

I've followed many tutorials, including excellent posts by a Danish guy. But I can't make it work. I've tried to use all combinations of "fastcgi_param SCRIPT_FILENAME", ALIAS, etc, including hardcoding another directory into it to make sure this was (or not) the cause of the problem.

So, here are the questions:

  1. Is it possible to use symlinks for PHP execution under nginx or lighttpd?
  2. This setup is for development only, is there a reason not to use it?
  3. What kind of magic would be necessary to make it work?

Since the target environment is going to be nginx (there are other projects already working), I would like to stick to nginx for development, if possible. For the sake of speed, I would also use lighttpd too. I would like to avoid Apache (only because of resources), if feasible.

Luis Soeiro
  • 4,162
  • 5
  • 33
  • 45
  • Interesting. My devbox (centos 5.x) has symbolic links all over the place, and nginx works perfectly fine with php script. Have you tried centos? – Chuan Ma Mar 15 '13 at 02:17
  • What's in nginx's error log? I've had been using symlinks in my development for years without any issue. So I'm sure you can do this with nginx. – Chuan Ma Mar 15 '13 at 02:28
  • http://stackoverflow.com/questions/12624358/nginx-not-following-symlinks ? – Danack Mar 15 '13 at 12:34

0 Answers0