noob needs help with alias locations and php

Mike Wright nobody at
Thu May 28 04:49:27 UTC 2015

Hi all,

Been going in circles for the third day now.

The server handles files and php scripts as long as they are at or 
beneath the document root.  Here are the two problems I haven't been 
able to figure out:
     Directory index of ... is forbidden
     Can't get to docs not beneath the document_root.

Example of places I want to go:

non-root targets:               as:
/home/mike/Movies/index.html    /movies/index.html    200
/home/mike/Movies/index.php     /movies/index.php     "File not found."
/home/mike/Movies/1/index.html  /movies/1/index.html  404
/home/mike/Movies/1/index.php   /movies/1/index.php   "File not found."

File not found : "Primary script unknown";
404 : the log shows the correct GET path;
A lot of my experiments end up with 301 : endless redirects;

http {
   index             index.html index.php;

server {
   listen            80;
   server_name       localhost lo;
   root              /var/www/sites/localhost/www;

   location          / {
     try_files       $uri $uri/ /index.html /index.php;

   location          /movies {
     alias           /home/mike/Movies/;

   location       ~  \.php$ {
     root            /var/www/sites/localhost/www;
     include         fastcgi_params;
     fastcgi_index   index.php;
     fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;

If I can get past these hurdles I'll probably (hopefully) be able to 
figure most of the rest of this stuff out.

Tips, pointers appreciated.  Helper?

Mike Wright

More information about the nginx mailing list