服务器
这期内容当中小编将会给大家带来有关使用nginx怎么实现域名验证,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
方案一
配置有 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怎么实现域名验证了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注西部数码资讯频道。
cn域名出售平台哪个好?cn的域名有什么优点?云虚拟主机是服务器吗申请国外免费域名注意事项及域名详解微信“互选广告”内测上线 对广告主和流量主意味着什么?基于KVM的SRIOV直通配置及性能测试阿里云服务器域名禁止访问网站网页设计的目的 手机网页制作工具有哪些建站系统开源应该怎么选?