Nginx 訪問靜態資源報錯404 Not Found 的問題解決過程
1、靜態資源訪問報錯404:
[[email protected]_121_21 tmp]$ wget http://bsstatic.powerlong.com/commonStatic/css/merchant_patch.css --2016-11-22 18:18:28-- http://bsstatic.powerlong.com/commonStatic/css/merchant_patch.css 正在解析主機 bsstatic.powerlong.com... 192.168.121.91 正在連線 bsstatic.powerlong.com|192.168.121.91|:80... 已連線。 已發出 HTTP 請求,正在等待迴應... 404 Not Found 2016-11-22 18:18:28 錯誤 404:Not Found。 [[email protected]_121_21 tmp]$ |
telnet埠是OK的
[[email protected]_121_21 ~]# telnet bsstatic.powerlong.com 80 Trying 192.168.121.91... Connected to bsstatic.powerlong.com. Escape character is '^]'. |
2、檢視iptables狀態,有多餘的 output記錄
[[email protected]_121_21 ~]# service iptables status 表格:nat Chain PREROUTING (policy ACCEPT) num target prot opt source destination 1 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8081 Chain POSTROUTING (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination 1 REDIRECT tcp -- 0.0.0.0/0 127.0.0.1 tcp dpt:80 redir ports 8081 2 REDIRECT tcp -- 0.0.0.0/0 127.0.0.1 tcp dpt:80 redir ports 8081 3 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8081 [[email protected]_121_21 ~]# |
3、刪除配置檔案,多餘的2條OUTPUT記錄,保持一條配置記錄,如下所示
[[email protected]_121_21 ~]# vim /etc/sysconfig/iptables # Generated by iptables-save v1.4.7 on Tue Nov 22 12:34:48 2016 *nat :PREROUTING ACCEPT [22:1583] :POSTROUTING ACCEPT [6:326] :OUTPUT ACCEPT [6:326] -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8081 -A OUTPUT -d 127.0.0.1/32 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8081 COMMIT # Completed on Tue Nov 22 12:34:48 2016 |
4、然後重啟iptables服務
重啟iptables服務
[[email protected]_121_21 ~]# service iptables restart iptables:清除防火牆規則: [確定] iptables:將鏈設定為政策 ACCEPT:filter nat [確定] iptables:正在解除安裝模組: [確定] iptables:應用防火牆規則: [確定] [[email protected]_121_21 ~]# |
然後檢視iptables狀態,只有一條REDIRECT記錄存在:
[[email protected]_121_21 ~]# service iptables status 表格:nat Chain PREROUTING (policy ACCEPT) num target prot opt source destination 1 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 8081 Chain POSTROUTING (policy ACCEPT) num target prot opt source destination Chain OUTPUT (policy ACCEPT) num target prot opt source destination 1 REDIRECT tcp -- 0.0.0.0/0 127.0.0.1 tcp dpt:80 redir ports 8081 [[email protected]_121_21 ~]# |
5、再嘗試下,wget下載,可以wget成功了
[[email protected]_121_21 ~]# wget http://bsstatic.powerlong.com/commonStatic/css/merchant_patch.css --2016-11-22 18:27:52-- http://bsstatic.powerlong.com/commonStatic/css/merchant_patch.css 正在解析主機 bsstatic.powerlong.com... 192.168.121.91 正在連線 bsstatic.powerlong.com|192.168.121.91|:80... 已連線。 已發出 HTTP 請求,正在等待迴應... 200 OK 長度:18298 (18K) [text/css] 正在儲存至: “merchant_patch.css” 100%[====================================================================================================================================================================================================================================>] 18,298 --.-K/s in 0s 2016-11-22 18:27:52 (77.6 MB/s) - 已儲存 “merchant_patch.css” [18298/18298]) |
總結:telnet能進nginx的80埠,但是HTTP請求訪問拒絕,而nginx服務正常啟動的情況下,一般就要檢視下iptables埠轉發,90%的問題都是因為iptables配置引發的。
相關推薦
Nginx 訪問靜態資源報錯404 Not Found 的問題解決過程
1、靜態資源訪問報錯404:[[email protected]_121_21 tmp]$ wget http://bsstatic.powerlong.com/commonStatic/css/merchant_patch.css --2016-11-22 1
使用nginx訪問靜態檔案報錯 403 Forbidden 的解決辦法
在nginx配置了靜態檔案之後,然後執行nginx,然後訪問的時候報錯403 Forbidden,主要是原因是nginx配置檔案中的指定使用者有問題,預設nginx.conf最頂部user nobody;很多人說修改為user root就可以解決,但是當我修改為user root之後,又報錯如下錯誤
Mantis:Mantis rest api url 404 Not Found.解決過程紀錄
測試Mantis rest api時碰到的問題:404 Not Found. 根據檔案,Mantis rest api的預設url是{{url}}/api/rest/{{controller}}。 其中{{url}}的部分是Mantis實體的base url,{{controller}}則是各api的
nginx作為反向代理訪問靜態資源報404錯以及nginx: [error] OpenEvent("Global\ngx_reload_5744") failed (2: The sys
系統是win10 相關.conf的配置如下,感覺沒問題,但nginx一直報404 server{ listen 80; autoindex off; server_name wanghz
nginx 代理靜態資源報 403
cat 刷新 html 訪問 style nbsp body cal bin 用tomcat跑了一個上傳服務,文件上傳到指定nginx的html目錄,用nginx來代理靜態資源,結果上傳能夠成功,訪問卻報403。 解決辦法,將html的擁有者改成nobody: ch
nginx訪問靜態資源配置
配置了幾天,出現的問題是:訪問自己配的網址能夠正常訪問,但是一旦訪問該網址下某個資源就會出現404 not found.試了很多辦法,都沒有解決,今天一次機緣巧合之下解決了,問題很簡單,但是還是想記錄一下: 正常訪問image.imooc.com
tomcat中部署專案後,訪問失敗,報錯404的原因以及解決方案
MyEclipse中報的錯誤: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].Sta
centos下pip安裝mysql_python報錯mysql_config not found
1.安裝mysql_python時,出現如下錯誤: Collecting mysql-python (from -r pip_requirements.txt (line 8)) Using cached&nb
Xcode 10 升級專案報錯 “directory not found for option” and “library not found for -libstdc++.6 ~解決方法
聯絡人:石虎 QQ:1224614774 暱稱: 嗡嘛呢叭咪哄 &
git拉取GitLab工程報錯Repository not found
# git clone http://xxx/jiqing/frog.git 正克隆到 'frog'... fatal: repository 'http://xxx/jiqing/frog.git/' not found 原因:因為以前使用過其他帳號配置資訊都儲存了,然後帳號密碼預設用以前的導致拉取沒有許
Android studio3 報錯module not specified解決方案
說一下我的環境: Android Studio 3.2.1 Build #AI-181.5540.7.32.5056338, built on October 9, 2018 JRE: 1.8.0_152-release-1136-b06 amd64 JVM: OpenJDK 64-Bit
Xcode10升級專案報錯library not found for -lstdc++.6.0.9
專案一直用Xcode9 進行編譯,突然之間蘋果手機自動升級到ios12了,然而xcode就編譯不了了,必須切換到xcode10. 切換到xcode10,就編譯不過去了,報以下錯: 會看到報錯:library not found for -lstdc++.6.0.9
Ubuntu sudo報錯command not found的解決方法
Ubuntu系統操作中,在使用sudo的時候出現sudo:source:command not found錯誤提示,遇到這種問題要如何處理呢?下面小編就給大家介紹下Ubuntu系統中報錯sudo:source:command not found的解決方法。 Ubuntu
執行 shell 報錯 source:not found。一行註釋解決
解決方法: 在 shell 指令碼的第一行加上一行 "#!/bin/bash" 即可。 例如: #!/bin/bash source /etc/environment 問題原因: s
mamp +nginx 配置Tp5專案時出現 404 Not Found nginx/1.11.4一次排查和解決
1.首先看了nginx報錯日誌 報 signal process started signal process started表示還有 產生原因 1、可能你的nginx.conf 內容
使用npm install報錯- operation not permitted解決
這幾天使用npm install時一直報錯-4048 operation not permitted,也嘗試了多種方法,終於使問題得到解決,這裡總結幾種方法,先貼圖: 一:許可權問題首先看到operation not permitted我們能想到許可權問題,所以這時候我們可以
react報錯Module not found: Error: Can't resolve
學習react專案,想把.js結尾的檔案改為.jsx結尾,結果一直報錯,網上找了好久,總算解決了,在webpack.dev.config.js檔案中新增resolve: { extensions: ['.
Xcode編譯報錯library not found for -lAFNetworking
更新了macOS之後重新pod install了一下,結果之前好好的AFNetworking突然一直報錯,始終是: ld: library not found for -lAFNetworking clang: error: linker command f
Spark 使用Phoenix往HBase插入資料報錯 PhoenixOutputFormat not found
叢集版本:cdh5.8 Phoenix版本:4.7.0 專案依賴管理:Maven 描述: 在工作中,需要使用Phoenix往HBase寫資料,但是除錯的時候出現問題 17/06/12 09:35:46 ERROR kerberos.SaveAsPhoeni
編譯報錯framework not found Metal for architecture armv7 問題
Ever since Apple introduced iOS SDK 8.0, apps referencing CoreVideo or OpenGLES may encounter the following linker error: framework not