日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

使用Nginx怎么实现域名验证

發布時間:2024/1/3 综合教程 29 生活家
生活随笔 收集整理的這篇文章主要介紹了 使用Nginx怎么实现域名验证 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

服務器

這期內容當中小編將會給大家帶來有關使用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怎么實現域名驗證了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關知識,歡迎關注新網資訊頻道。

總結

以上是生活随笔為你收集整理的使用Nginx怎么实现域名验证的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。