nginx启动后 域名访问出现:504 Gateway Time-out

来源:17-6 .nginx负载均衡配置及验证

慕粉113505763

2019-02-28

1.nginx启动无错误
图片描述2.ip访问也无问题
图片描述图片描述3.域名访问出现504
图片描述
知道解决方法的留个言,谢谢了!

写回答

2回答

慕粉113505763

提问者

2019-03-01


upstream www.mallshi.online{
        server 127.0.0.1:8080;
        server 127.0.0.1:9080;
}

server {
listen 80;
autoindex on;
server_name mallshi.online www.mallshi.online;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
if ( $query_string ~* ".*[\;'\<\>].*" ){
        return 404;
        }

location = / {
        root /product/front/mmall_fe/dist/view;
        index index.html;
}

location ~ .*\.html$ {
        root /product/front/mmall_fe/dist/view;
        index index.html;
}

location / {
        proxy_pass http://www.mallshi.online/;
        }

location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
        proxy_pass http://mallshi.online;
        expires 30d;
        }

location ~ .*\.(js|css)?$ {
        proxy_pass http://mallshi.online;
        expires 7d;
                                    

0
0

geelylucky

2019-02-28

亲爱的同学,你好,我是geely老师的助教。

你应该贴出你的nginx的配置,启动没报错不代表你的配置正确,只能说明你的配置语法没错,不代表配置的逻辑正确。

0
2
geelylucky
回复
慕粉113505763
你可以先删掉下面的内容再试试 index index.html index.htm index.jsp index.php; if ( $query_string ~* ".*[\;'\<\>].*" ){ return 404; } location = / { root /product/front/mmall_fe/dist/view; index index.html; } location ~ .*\.html$ { root /product/front/mmall_fe/dist/view; index index.html; }
2019-03-01
共2条回复

Java企业级电商项目架构 Tomcat集群与Redis分布式

Tomcat集群+Redis分布式+代码重构+源码原理解析

2688 学习 · 947 问题

查看课程