A
A
alexxzhuravlev2016-07-22 21:03:53
Nginx
alexxzhuravlev, 2016-07-22 21:03:53

How to find out what is the reason for 404 location in nginx?

There is a config

server {
    listen 80;
    root /var/www/home;
    access_log /var/www/home/access.log;
    error_log /var/www/home/error.log;

    index index.php index.html index.htm;

    server_name home;

    location / {
    	try_files $uri $uri/ /index.php?$args; #if doesn't exist, send it to index.php
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;

    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/run/php/php-fpm.sock;

    fastcgi_index index.php;
    include fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param PHP_VALUE "error_log=/var/www/home/php_errors.log";
    }

    location ~* /Admin {
    allow 127.0.0.1;
    deny all;
    }
}

There is one moment when the request goes to /Admin from 127.0.0.1 nginx gives the 404 header, although the request itself is processed and the content is returned. Where did I screw up?

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