NGINX Document Location

Posted by GLaDOS on Server Fault See other posts from Server Fault or by GLaDOS
Published on 2013-10-28T03:17:56Z Indexed on 2013/10/28 3:56 UTC
Read the original article Hit count: 161

Filed under:
|

I want to be able to access a given url, example.com/str. The problem is that the php file that I want to connect to is in a directory of /str/public/. In my nginx logs, I see that it is trying to connect to /str/public/str/index.php. Is there any way to remove that last 'str' in the document request?

Below is my location directive in sites-available/default:

    location /str {
        root /usr/share/nginx/html/str/public/;
        index index.php index.html index.htm;
        location ~ ^/str/(.+\.php)$ {
                try_files $uri = 404;
                root /usr/share/nginx/html/str/public/;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
    }

Thank you all so much in advance.

© Server Fault or respective owner

Related posts about nginx

Related posts about webserver