整合营销服务商

电脑端+手机端+微信端=数据同步管理

免费咨询热线:

网站404或空白怎么办?

网站404或空白怎么办?

户反映:说自己的网站走nginx代理后,打开空白。直接IP加地址访问是好的(http://ip:port)

故障排查

1、打开chrome浏览器,访问了下,访问情况真是客户描述的那样。

2、感觉打开chrome ,开发者工具,发现部分请求URL是404,css和js的



3、找客户要服务器登录的账号,检查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、大家有发现上面配置有问题不?刚开始我也没有注意,自认为配置文件是对 的。

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

故障原因:

是因为 “location ~ .*\.(js|css)?$” 这个匹配拦截掉了,请求不能正常发往下一个“location /” ,也就不能正常抵达后端proxy_pass了。

解决方法:

第一种解决方法:是将后端的静态文件(css 和js ),放入前置nginx 机器/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的书籍,尝试使用记事本编写第一个网页,不料,打开网页后,竟然是乱码状态,愁煞吾也,这个问题怎么破呢?经查相关资料,是因为记事本默认存储的编码格式与html中的编码格式不一致导致的.....

情况具体是这样的:

第一步是将写好的内容的记事本的后缀“TXT”改成了HTML

打开网页之后是这样的:乱码


查阅资料后,解决方法是这样的:

在网页空白处点击右键,找到编码点击,选择UTF-8,问题就解决了。



还有一种方法就是,使用记事本另存为修改后缀名为HTML,编码处选择UTF-8,就不会出现乱码现象了。

题1:openj9环境使用profiler命令输出内存火焰图为空

问题现象

基于openjdk,使用-d参数控制持续60s后自动停止,使用浏览器打开html报告,内容显示正常:

[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参数控制持续60s后自动停止,使用浏览器打开html报告,内容显示空白:

[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 

解决方法

profileropenjdk-openj9的支持还不够全面,可以通过不加-d参数,主动stop临时规避:

[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 

使用这种方法,可以正常输出基于内存的火焰图。