自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

網(wǎng)站404或空白怎么辦?

系統(tǒng) Linux
客戶反映:說自己的網(wǎng)站走nginx代理后,打開空白。直接IP加地址訪問是好的(http://ip:port)。

客戶反映:說自己的網(wǎng)站走nginx代理后,打開空白。直接IP加地址訪問是好的(http://ip:port)。

[[275208]]

故障排查:

(1) 打開chrome瀏覽器,訪問了下,訪問情況真是客戶描述的那樣。

(2) 感覺打開chrome ,開發(fā)者工具,發(fā)現(xiàn)部分請求URL是404,css和js的

(3) 找客戶要服務(wù)器登錄的賬號,檢查nginx配置文件

  1. upstream www.test.com{ 
  2.   server 127.0.0.1:8080; 
  3. server { 
  4.   listen 80; 
  5.   listen 443 ssl http2; 
  6.   ssl_certificate /usr/local/nginx/conf/ssl/www.test.com.pem; 
  7.   ssl_certificate_key /usr/local/nginx/conf/ssl/www.test.com.key; 
  8.   server_name www.test.com; 
  9.   access_log /data/wwwlogs/www.test.com_nginx.log combined; 
  10.   index index.html index.htm index.jsp; 
  11.   root /data/wwwroot/www.test.com; 
  12.      
  13.   
  14.   location ~ .*\.(js|css)?$ { 
  15.     
  16.     expires 7d; 
  17.     access_log off; 
  18.   } 
  19.  
  20.   location / { 
  21.     proxy_pass http://www.test.com; 
  22.     include proxy.conf; 
  23.   } 

(4) 大家有發(fā)現(xiàn)上面配置有問題不?剛開始我也沒有注意,自認(rèn)為配置文件是對 的。

打算檢查nginx的日志,一遍請求URL,一遍查看nginx果然還是404.(感覺疑惑),明明配置了proxy_pass http://www.test.com。

故障原因:

是因為 “location ~ .*\.(js|css)?$” 這個匹配攔截掉了,請求不能正常發(fā)往下一個“location /” ,也就不能正常抵達(dá)后端proxy_pass了。

解決方法:

第一種解決方法:是將后端的靜態(tài)文件(css 和js ),放入前置nginx 機器/data/wwwroot/www.test.com

第二種解決方法 :修改配置文件

  1. upstream www.test.com{ 
  2.   server 127.0.0.1:8080; 
  3. server { 
  4.   listen 80; 
  5.   listen 443 ssl http2; 
  6.   ssl_certificate /usr/local/nginx/conf/ssl/www.test.com.pem; 
  7.   ssl_certificate_key /usr/local/nginx/conf/ssl/www.test.com.key; 
  8.   server_name www.test.com; 
  9.   access_log /data/wwwlogs/www.test.com_nginx.log combined; 
  10.   index index.html index.htm index.jsp; 
  11.   root /data/wwwroot/www.test.com; 
  12.      
  13.  
  14.   location ~ .*\.(js|css)?$ { 
  15.       proxy_pass http://www.test.com; 
  16.     expires 7d; 
  17.     access_log off; 
  18.   } 
  19.  
  20.   location / { 
  21.     proxy_pass http://www.test.com; 
  22.     include proxy.conf; 
  23.   } 

 

責(zé)任編輯:趙寧寧 來源: Linux運維技術(shù)之路
相關(guān)推薦

2011-06-30 17:58:30

網(wǎng)站被K

2011-03-29 16:30:18

2024-07-29 08:01:32

2011-08-29 15:58:58

2011-06-27 15:42:23

降權(quán)SEO

2015-12-07 14:11:01

2021-09-28 10:55:12

釣魚網(wǎng)站網(wǎng)絡(luò)攻擊信息安全

2009-11-03 08:56:02

linux死機操作系統(tǒng)

2024-04-22 08:17:23

MySQL誤刪數(shù)據(jù)

2017-02-21 13:11:43

SDN網(wǎng)絡(luò)體系SDN架構(gòu)

2022-12-19 11:31:57

緩存失效數(shù)據(jù)庫

2022-05-19 08:01:49

PostgreSQL數(shù)據(jù)庫

2018-01-28 20:39:39

戴爾

2019-10-12 09:50:46

Redis內(nèi)存數(shù)據(jù)庫

2022-07-05 11:48:47

MySQL死鎖表鎖

2015-10-22 09:09:59

BAT投資VC

2011-07-28 13:45:06

2024-10-09 17:06:52

RedisHash哈希表

2017-12-21 20:01:38

潤乾報表

2020-03-18 19:00:29

電腦內(nèi)存不足系統(tǒng)
點贊
收藏

51CTO技術(shù)棧公眾號