這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)使用Nginx怎么實(shí)現(xiàn)域名驗(yàn)證,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。
方案一
配置有 root 的 server,直接把隨機(jī)文檔放置在該目錄下即可,不需要重啟 nginx 服務(wù)。
方案二
匹配路由,指定隨機(jī)文檔所在目錄, 需要重啟 nginx。
location ~* 6CysNYj8Hb\.txt { root /data/ftp; }
方案三(推薦)
匹配路由,直接返回需要驗(yàn)證的隨機(jī)字符串,需要重啟 nginx。
location = /6CysNYj8Hb.txt { default_type text/html; return 200 '01df2ddab4774ba2676a5563ccb79ffa'; }
參考
Nginx 的 Location 從零開始配置
nginx 配置返回文本或 json
補(bǔ)充:Nginx域名重定向
1、更改配置文件test.com.conf
[root@jimmylinux-001 vhost]# vim test.com.conf server { 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測(cè)試
[root@jimmylinux-001 vhost]# /usr/local/nginx/sbin/nginx -t nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful [root@jimmylinux-001 vhost]# /usr/local/nginx/sbin/nginx -s reload [root@jimmylinux-001 vhost]# curl -x127.0.0.1:80 test2.com/index.html -I HTTP/1.1 301 Moved Permanently Server: nginx/1.12.1 Date: Thu, 07 Jun 2018 16:47:36 GMT Content-Type: text/html Content-Length: 185 Connection: keep-alive Location: http://test.com/index.html [root@jimmylinux-001 vhost]# curl -x127.0.0.1:80 test2.com/admin/index.html -I HTTP/1.1 301 Moved Permanently Server: nginx/1.12.1 Date: Thu, 07 Jun 2018 16:48:08 GMT Content-Type: text/html Content-Length: 185 Connection: keep-alive Location: http://test.com/admin/index.html [root@jimmylinux-001 vhost]# curl -x127.0.0.1:80 test3.com/admin/index.html/adjlfj -I HTTP/1.1 301 Moved Permanently Server: nginx/1.12.1 Date: Thu, 07 Jun 2018 16:48:35 GMT Content-Type: text/html Content-Length: 185 Connection: keep-alive Location: http://test.com/admin/index.html/adjlfj [root@jimmylinux-001 vhost]# curl -x127.0.0.1:80 test4.com/admin/index.html/adjlfj -I HTTP/1.1 404 Not Found Server: nginx/1.12.1 Date: Thu, 07 Jun 2018 16:48:43 GMT Content-Type: text/html Content-Length: 169 Connection: keep-alive
上述就是小編為大家分享的使用Nginx怎么實(shí)現(xiàn)域名驗(yàn)證了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)成都網(wǎng)站設(shè)計(jì)公司行業(yè)資訊頻道。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
當(dāng)前題目:使用Nginx怎么實(shí)現(xiàn)域名驗(yàn)證-創(chuàng)新互聯(lián)
URL地址:http://aaarwkj.com/article22/dopjjc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、App設(shè)計(jì)、網(wǎng)站設(shè)計(jì)公司、手機(jī)網(wǎng)站建設(shè)、小程序開發(fā)、網(wǎng)站排名
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容