Nginx转发404

server {
       listen 443;
       ssl on;
       ssl_certificate_key  /usr/sher/nginx/nginx.key;
       ssl_certificate /usr/sher/nginx/nginx.pem;
       server_name localhost;
       client_max_body_size 80M;
       root /var/www/weihu;
       index  index.html index.php  index.htm;
       location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
       # 定义错误页面码,如果出现相应的错误页面码,转发到那里。
       error_page  404 403 500 502 503 504  /index.html;
       location = /index.html {
# 放错误页面的目录路径。 root
/var/www/weihu; } }

 

posted @ 2020-07-29 17:01  NickCqila  阅读(662)  评论(0编辑  收藏  举报