Nginx 404未找到错误

时间:2017-10-02 06:23:47

标签: nginx

嗨我正在使用这个配置文件为我们的webuzo面板服务器与yeti共享文件主机脚本。对于这个nginx配置我们也给了网站路径的根,但我们的页面没有显示其所有页面显示404错误。我们在服务器上使用的配置文件。

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid     /usr/local/apps/nginx/var/log/nginx.pid;

events {
    worker_connections  1024;
}

error_log /usr/local/apps/nginx/var/log/error_log debug;


http {
    include    mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log /usr/local/apps/nginx/var/log/web.access.log  main;

    server {
    listen       80;
    server_name  localhost; # change this for your server
    root /home/wshr/public_html;
    index index.php;
    client_max_body_size 5G;

    # handle requests to the API
    location ~ /api/v2/(.+)$ {
        if (!-e $request_filename) { rewrite ^/api/v2/(.*) /api/v2/index.php?_page_url=$1 last; }
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        if (!-e $request_filename) { rewrite ^/(.*) /index.php?_page_url=$1 last; }
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location / {
        if (!-e $request_filename) {
                rewrite ^/(.*) /index.php?_page_url=$1 last;
        }
    }

    location /files/ {
        internal;
    }

    # these locations would be hidden by .htaccess normally
    location /core/logs/ {
        deny all;
    }

    location ~* "/\.(htaccess|htpasswd)$" {
        deny    all;
        return  404;
    }
}




        sendfile        on;
    #tcp_nopush  on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    client_max_body_size 200M;

    # If your domain names are long, increase this parameter.
    server_names_hash_bucket_size 64;

    # To hide the version number in headers
    server_tokens off;

    include /usr/local/apps/nginx/etc/conf.d/*.conf;
}

请帮助我做什么。我改变了什么 因为我们所有页面都显示404错误,只有首页显示正常

0 个答案:

没有答案