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

How to implement Domain name Verification with Nginx

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

In this issue, the editor will bring you about how to use Nginx to achieve domain name verification. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

Option one

With server configured with root, you can directly place random documents in this directory. There is no need to restart the nginx service.

Option 2

Match the route, specify the directory where the random document is located, and restart nginx.

Location ~ * 6CysNYj8Hb\ .txt {root / data/ftp;}

Option 3 (recommended)

Match the route, return the random string that needs to be verified directly, and restart nginx.

Location = / 6CysNYj8Hb.txt {default_type text/html; return 20001df2ddab4774ba2676a5563ccb79ffakeeper;}

Referenc

Configuration of Location for Nginx from scratch

Nginx configuration returns text or json

Supplement: Nginx domain name redirection

1. Change the configuration file test.com.conf

[root@jimmylinux-001 vhost] # vim test.com.confserver {listen 80; server_name test.com test2.com test3.com; index index.html index.htm index.php; root/ data/wwwroot/test.com; if ($host! = 'test.com') {rewrite ^ / (. *) $http://test.com/$1 permanent;}}

2. Curl test

[root@jimmylinux-001 vhost] # / usr/local/nginx/sbin/nginx-tnginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is full [root @ jimmylinux-001 vhost] # / usr/local/nginx/sbin/nginx-s reload [root @ jimmylinux-001 vhost] # curl-x127.0.1 curl 80 test2.com/index.html-IHTTP/1.1 301 Moved PermanentlyServer: nginx/1.12.1Date: Thu 07 Jun 2018 16:47:36 GMTContent-Type: text/htmlContent-Length: 185Connection: keep-aliveLocation: http://test.com/index.html[root@jimmylinux-001 vhost] # curl-x127.0.1 GMTContent-Type 80 test2.com/admin/index.html-IHTTP/1.1 301 Moved PermanentlyServer: nginx/1.12.1Date: Thu 07 Jun 2018 16:48:08 GMTContent-Type: text/htmlContent-Length: 185Connection: keep-aliveLocation: http://test.com/admin/index.html[root@jimmylinux-001 vhost] # curl-x127.0.1 GMTContent-Type 80 test3.com/admin/index.html/adjlfj-IHTTP/1.1 301 Moved PermanentlyServer: nginx/1.12.1Date: Thu 07 Jun 2018 16:48:35 GMTContent-Type: text/htmlContent-Length: 185Connection: keep-aliveLocation: http://test.com/admin/index.html/adjlfj[root@jimmylinux-001 vhost] # curl-x127.0.1 GMTContent-Type 80 test4.com/admin/index.html/adjlfj-IHTTP/1.1 404 Not FoundServer: nginx/1.12.1Date: Thu 07 Jun 2018 16:48:43 GMTContent-Type: text/htmlContent-Length: 169Connection: keep-alive above is what the editor shares with you about how to use Nginx to achieve domain name verification. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are 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

Servers

Wechat

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

12
Report