未找到Nginx erorr 404

时间:2018-12-13 18:21:55

标签: php nginx

网站试图访问“ php-scripts”文件夹中的“ contact_form.php”文件时显示404错误。 我有这个Nginx配置:


    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /var/run/nginx.pid;

    # Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;

    events {
        worker_connections 1024;
    }

    http {
        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  /var/log/nginx/access.log  main;

        sendfile            on;
        tcp_nopush          on;
        tcp_nodelay         on;
        keepalive_timeout   65;
        types_hash_max_size 2048;

        include             /etc/nginx/mime.types;
        default_type        application/octet-stream;

        # Load modular configuration files from the /etc/nginx/conf.d directory.
        # See http://nginx.org/en/docs/ngx_core_module.html#include
        # for more information.
        include /etc/nginx/conf.d/*.conf;

        index   index.html index.php index.htm;



    server {
            listen       80 default_server;
            listen       [::]:80 default_server;
            server_name  localhost;
            root         /var/www/html/myapp;

            # Load configuration files for the default server block.
            include /etc/nginx/default.d/*.conf;

            location / {
            try_files $uri $uri/ /index.php?$args;
            }

            # redirect server error pages to the static page /40x.html
            #
            error_page 404 /404.html;
                location = /40x.html {
            }

            # redirect server error pages to the static page /50x.html
            #
            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
        }

有人可以告诉我nginx config怎么了吗,或者还有其他原因导致我收到此错误?

0 个答案:

没有答案