Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Nginx default virtual host how to add in server

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly shows you "Nginx default virtual host how to add in server", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "Nginx default virtual host how to add in server" this article.

Nginx default virtual host takes effect when the user accesses it through IP or through an unset domain name (for example, someone points his own domain name to your ip). Add this line to the server settings:

Listen 80 default

The following default parameter indicates that this is the default virtual host.

This setting is very useful.

For example, when someone visits your site through ip or an unknown domain name, and you want to disable any valid content, you can return it to him. At present, many computer rooms in China require website owners to turn off empty host headers to prevent undocumented domain names from pointing to cause trouble. The default virtual host for Nginx can be set as follows:

Server {listen 80 default; return 500;}

You can also collect these traffic and import them to your own website, as long as you make the following jump settings:

Server {listen 80 default; rewrite ^ (. *) http://www.myip.net permanent;} these are all the contents of the article "how to add Nginx default virtual hosts to server". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report