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
Table of contents background question Problem ana...
1. Function Mainly used to preserve component sta...
1. Meaning of partition table A partition table d...
Table of contents 1. Introduction to High Availab...
When the img src value is empty, two requests are ...
Install and configure the MySql database system. ...
What I bring to you today is to use jQuery to imp...
Using the CSS float property correctly can become...
Table of contents 1. Offline installation 2. Onli...
illustrate: Today, when continuing the last offic...
After obtaining the system time using Java and st...
need Configuring DingTalk alarms in Zabbix is s...
To do a paginated query: 1. For MySQL, it is not ...
Recently I changed Apache to nginx. When I moved ...
Table of contents 1. How is cross-domain formed? ...