UPDATE -- This is driving me nuts (or back to Apache...)
The issue is definitely symlinks and permissions
When I setup symlinks to directories in the same tree, for example /var/www/html/html2 --> /var/www/html2 it works fine. Also /var/www/html/test_alias --> /var/www/html/test works fine. It's just when pointing out a different volume that I get 403. I have sprinkled all those directories with read and exec rights and nginx ownerships, but nothing works. I have also tried adding
sendfile off; autoindex on; disable_symlinks off;
but to no avail! There must be something fundamental I am missing??
OK so I'm a beginner with Nginx, however I have successfully setup a number of Apache websites, so this can't be that difficult right?
Well, not really. At least not for me. I have struggled for a couple of days while setting up a server that can interpret PHP code. Nothing fancy at all.
I have FINALLY a version of nginx.conf that somewhat works. It loads php and html in that order, and defaults to index.php and index.html.
My root is /var/www/html, owned by user nginx. Files in "html" loads OK, but when I symlinked a directory under "html", they won't load. Can anyone give me a hint about whats wrong?
This is my conf:
events {
worker_connections 1024;
}
http {
index index.php index.html;
server {
listen 80 default_server;
server_name _; # This is just an invalid value which will never trigger on a real hostname.
server_name_in_redirect off;
root /var/www/html;
location ~ \.php$ {
root /var/www/html;
try_files $uri $uri/ =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
Directory structure is:
/var/www/html
these files load OK
/var/www/html/mysite
these files are not found/loaded
It would be great if someone could give me a solution to this problem. And if you also know a good reference with simple config examples I'd love to hear about them. God knows there exist plenty with incorrect/outdated/plain confusing config examples.