J
J
jangot2016-02-14 04:16:17
Nginx
jangot, 2016-02-14 04:16:17

Why is root not overridden in nginx?

there is a pretty simple config for nginx

server {
        listen 443;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
        ssl_session_cache   shared:SSL:10m;
        ssl_session_timeout 10m;
        ssl on;
        ssl_certificate /var/www/certificate/SSL.crt;
        ssl_certificate_key /var/www/certificate/mydomain.com.key;

        root /var/www/mydomain.com;
        index index.html index.htm index.php;

        error_log /var/www/error.log;

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;
        }

        location /front/ {
                root /home/someuser/front/deploy/current/public/;
                try_files /$uri /dist/index.html;
        }

Request https://maydomain.com/front returns 404
I assumed the search would be in /home/someuser/front/deploy/current/public. But the logs say:
2016/02/13 20:11:52 [error] 20775#0: *18 open() "/var/www/mydomain.com/dist/index.html" failed (2: No such file ordirectory), client: ***.***.***.***, server: , request: "GET /front/ HTTP/1.1", host: "mydomain.com"

I tried to write alias instead of root, but the result is the same.
Why doesn't the main root overlap?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question