Malkav
By:
Malkav

Nginx returning 404 for virtual server

December 24, 2014 598 views

Running Nginx on CentOS 7.
Here's my server conf.

server {
listen 80;
server_name templeofwisdom.ru;

    access_log  /home/bao/logs/templeofwisdom.ru/access.log  main;
    error_log  /home/bao/logs/templeofwisdom.ru/error.log error;

    root /home/bao/www/templeofwisdom.ru;
    index  index.php index.html index.htm;

    location / {
        root   /home/bao/www/templeofwisdom.ru;
        if (!-e $request_filename){
          rewrite ^/(.*)$ /index.php?q=$1 last;
        }
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/local/www/nginx-dist;
    }

   # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        root /home/bao/www/templeofwisdom.ru;
        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;
        fastcgi_ignore_client_abort on;
        fastcgi_param SERVER_NAME $http_host;
    }

    location ~ /\.ht {
        deny  all;
    }      

}

But when I try to access the server it returns error 404. The files are in place and as far as I can see are accessible.

Be the first one to answer this question.