使用Nginx怎么实现域名验证

服务器

这期内容当中小编将会给大家带来有关使用Nginx怎么实现域名验证,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。

十余年的清远网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整清远建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“清远网站设计”,“清远网站推广”以来,每个客户项目都认真落实执行。

方案一

配置有 root 的 server,直接把随机文档放置在该目录下即可,不需要重启 nginx 服务。

方案二

匹配路由,指定随机文档所在目录, 需要重启 nginx。

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

方案三(推荐)

匹配路由,直接返回需要验证的随机字符串,需要重启 nginx。

location=/6CysNYj8Hb.txt{default_typetext/html;return200'01df2ddab4774ba2676a5563ccb79ffa';}

参考

Nginx 的 Location 从零开始配置

nginx 配置返回文本或 json

补充:Nginx域名重定向

1、更改配置文件test.com.conf

[root@jimmylinux-001vhost]#vimtest.com.confserver{listen80;server_nametest.comtest2.comtest3.com;indexindex.htmlindex.htmindex.php;root/data/wwwroot/test.com;if($host!='test.com'){rewrite^/(.*)$http://test.com/$1permanent;}}

2、curl测试

[root@jimmylinux-001vhost]#/usr/local/nginx/sbin/nginx-tnginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisoknginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful[root@jimmylinux-001vhost]#/usr/local/nginx/sbin/nginx-sreload[root@jimmylinux-001vhost]#curl-x127.0.0.1:80test2.com/index.html-IHTTP/1.1301MovedPermanentlyServer:nginx/1.12.1Date:Thu,07Jun201816:47:36GMTContent-Type:text/htmlContent-Length:185Connection:keep-aliveLocation:http://test.com/index.html[root@jimmylinux-001vhost]#curl-x127.0.0.1:80test2.com/admin/index.html-IHTTP/1.1301MovedPermanentlyServer:nginx/1.12.1Date:Thu,07Jun201816:48:08GMTContent-Type:text/htmlContent-Length:185Connection:keep-aliveLocation:http://test.com/admin/index.html[root@jimmylinux-001vhost]#curl-x127.0.0.1:80test3.com/admin/index.html/adjlfj-IHTTP/1.1301MovedPermanentlyServer:nginx/1.12.1Date:Thu,07Jun201816:48:35GMTContent-Type:text/htmlContent-Length:185Connection:keep-aliveLocation:http://test.com/admin/index.html/adjlfj[root@jimmylinux-001vhost]#curl-x127.0.0.1:80test4.com/admin/index.html/adjlfj-IHTTP/1.1404NotFoundServer:nginx/1.12.1Date:Thu,07Jun201816:48:43GMTContent-Type:text/htmlContent-Length:169Connection:keep-alive

上述就是小编为大家分享的使用Nginx怎么实现域名验证了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注新网资讯频道。


名称栏目:使用Nginx怎么实现域名验证
网页网址:http://pwwzsj.com/article/cpghis.html