NGINX页面重定向到主页

时间:2019-03-10 04:58:08

标签: web nginx webserver

我在这里找到了有关重定向php和错误代码的答案,但不是从一个页面重定向到另一页面。我网站的一个方面是FTP上传器,而我的扩展名是mywebsite / ss / xyz.file。当前,我在/ ss中设置了index.html,因此人们可能看不到我的屏幕截图,但是我宁愿给他们一个404,而不是让所有404都转到/ ss或自动将其重定向到我的主页。 >

我当前的服务器块配置:

server {
        listen 80;
        listen [::]:80;

        root /var/www/xxx.xxx/html;
        index index.html phpinfo.php index.htm index.nginx-debian.html;

        server_name mangoman.me www.xxx.xxx

        location \ {
                proxy_pass http://localhost:8080;
        }

        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/run/php/php7.2-fpm.sock;
        }

        error_page 404 /custom_404.html;
        location = /custom_404.html {
                root /usr/share/nginx/html;
                internal;
        }
}

1 个答案:

答案 0 :(得分:0)

我实际上想出了自己的答案。

        location /ss {
        return 404;
        }