电脑网页打开全部显示空白 为什么网页打开是空白


电脑网页打开全部显示空白 为什么网页打开是空白


电脑网页打开全部显示空白 为什么网页打开是空白


电脑网页打开全部显示空白 为什么网页打开是空白


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; }}?

    推荐阅读