Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537 Warning: error_log(/data/www/wwwroot/hmttv.cn/caches/error_log.php): failed to open stream: Permission denied in /data/www/wwwroot/hmttv.cn/phpcms/libs/functions/global.func.php on line 537
戶反映:說自己的網(wǎng)站走nginx代理后,打開空白。直接IP加地址訪問是好的(http://ip:port)
故障排查:
1、打開chrome瀏覽器,訪問了下,訪問情況真是客戶描述的那樣。
2、感覺打開chrome ,開發(fā)者工具,發(fā)現(xiàn)部分請(qǐng)求URL是404,css和js的
3、找客戶要服務(wù)器登錄的賬號(hào),檢查nginx配置文件
upstream www.test.com{ server 127.0.0.1:8080; } server { listen 80; listen 443 ssl http2; ssl_certificate /usr/local/nginx/conf/ssl/www.test.com.pem; ssl_certificate_key /usr/local/nginx/conf/ssl/www.test.com.key; server_name www.test.com; access_log /data/wwwlogs/www.test.com_nginx.log combined; index index.html index.htm index.jsp; root /data/wwwroot/www.test.com; location ~ .*\.(js|css)?$ { expires 7d; access_log off; } ? location / { proxy_pass http://www.test.com; include proxy.conf; } }
4、大家有發(fā)現(xiàn)上面配置有問題不?剛開始我也沒有注意,自認(rèn)為配置文件是對(duì) 的。
打算檢查nginx的日志,一遍請(qǐng)求URL,一遍查看nginx果然還是404.(感覺疑惑),明明配置了proxy_pass http://www.test.com。
故障原因:
是因?yàn)?“l(fā)ocation ~ .*\.(js|css)?$” 這個(gè)匹配攔截掉了,請(qǐng)求不能正常發(fā)往下一個(gè)“l(fā)ocation /” ,也就不能正常抵達(dá)后端proxy_pass了。
解決方法:
第一種解決方法:是將后端的靜態(tài)文件(css 和js ),放入前置nginx 機(jī)器/data/wwwroot/www.test.com
第二種解決方法 :修改配置文件
upstream www.test.com{ server 127.0.0.1:8080; } server { listen 80; listen 443 ssl http2; ssl_certificate /usr/local/nginx/conf/ssl/www.test.com.pem; ssl_certificate_key /usr/local/nginx/conf/ssl/www.test.com.key; server_name www.test.com; access_log /data/wwwlogs/www.test.com_nginx.log combined; index index.html index.htm index.jsp; root /data/wwwroot/www.test.com; ? location ~ .*\.(js|css)?$ { proxy_pass http://www.test.com; expires 7d; access_log off; } ? location / { proxy_pass http://www.test.com; include proxy.conf; } }
?
天第一次看HTML5的書籍,嘗試使用記事本編寫第一個(gè)網(wǎng)頁,不料,打開網(wǎng)頁后,竟然是亂碼狀態(tài),愁煞吾也,這個(gè)問題怎么破呢?經(jīng)查相關(guān)資料,是因?yàn)橛浭卤灸J(rèn)存儲(chǔ)的編碼格式與html中的編碼格式不一致導(dǎo)致的.....
情況具體是這樣的:
第一步是將寫好的內(nèi)容的記事本的后綴“TXT”改成了HTML
打開網(wǎng)頁之后是這樣的:亂碼
查閱資料后,解決方法是這樣的:
在網(wǎng)頁空白處點(diǎn)擊右鍵,找到編碼點(diǎn)擊,選擇UTF-8,問題就解決了。
還有一種方法就是,使用記事本另存為修改后綴名為HTML,編碼處選擇UTF-8,就不會(huì)出現(xiàn)亂碼現(xiàn)象了。
基于openjdk,使用-d參數(shù)控制持續(xù)60s后自動(dòng)停止,使用瀏覽器打開html報(bào)告,內(nèi)容顯示正常:
[root@test arthas]# /usr/bin/java -jar arthas-boot.jar
[arthas@44794]$ profiler start -e alloc -d 60
Profiling started
profiler will silent stop after 60 seconds.
profiler output file will be: /arthas-output/20240326-171613.html
基于openjdk-openj9,同樣使用-d參數(shù)控制持續(xù)60s后自動(dòng)停止,使用瀏覽器打開html報(bào)告,內(nèi)容顯示空白:
[root@test arthas]# /usr/lib/openj9/bin/java -jar arthas-boot.jar
[arthas@7857]$ profiler start -e alloc -d 60
Profiling started
profiler will silent stop after 60 seconds.
profiler output file will be: /arthas-output/20240326-163013.html
profiler對(duì)openjdk-openj9的支持還不夠全面,可以通過不加-d參數(shù),主動(dòng)stop臨時(shí)規(guī)避:
[root@test arthas]# /usr/lib/openj9/bin/java -jar arthas-boot.jar
[arthas@7857]$ profiler start -e alloc
Profiling started
[arthas@7857]$ profiler stop
OK
profiler output file : /arthas-output/20240326-163522.html
使用這種方法,可以正常輸出基于內(nèi)存的火焰圖。
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。