Directly to the configuration file server { listen 80 default; # To prohibit direct access to the IP, you need to add default server_name ~.*; error_page 404 400 402 401 /404.html; # Define the HTML file corresponding to the error status code location = /404.html { # If you use a relative path, you should put the file in html/ under the nginx installation directory, for example: /usr/local/nginx/html/404.html root html; } error_page 500 /500.html; location = /500.html { root html; } error_page 502 /502.html; location = /502.html { root html; } location / { # You must write the access IP here to jump to the custom 500.html return 500; } #return 500; # If written like this, it will jump to nginx's default 500 page} This is the result of writing return 500; This is the location Additional knowledge: Solution to the problem that nginx still jumps to the welcome interface no matter how it is configured Hello, fellow ape friends. When you use nginx for the first time, do you encounter the problem that no matter how you modify the nginx.conf file, it still jumps to the welcome interface? Then I searched Baidu and it was all in vain. You say you are not desperate? Are you angry? Don't panic, the savior is coming. . . . . Causes of this problem: * Bro, you changed the wrong place. . . ** **After successfully installing nginx under Linux, people who use nginx for the first time will habitually find nginx.conf in the unzipped directory and then modify it. This is actually wrong and the modification will not have any effect. The correct way is to use the whereis nginx command to find the nginx.conf file in the nginx installation directory and modify it** The above operation of nginx prohibiting direct access through IP and jumping to a custom 500 page is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Ajax responseText parses json data case study
>>: Detailed steps for installing MySQL using cluster rpm
Color is one of the most important elements for a...
Indexing is similar to building bibliographic ind...
This article shares the specific code of vue echa...
This article shares a small example of adding and...
This article example shares the specific code for...
Execute the following command to report an error ...
An application of CSS animation, with the same co...
Table of contents 1. What is a design pattern? 2....
This article shares the specific code of js to im...
PS: I use PHPStudy2016 here 1. Stop MySQL during ...
To write a drop-down menu, click the button. The ...
This article example shares the specific code for...
question Because some of our pages request data i...
Prometheus (also called Prometheus) official webs...
Table of contents 1. Repeated declaration 1.1 var...