请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

直接访问域名报404 Not Found

直接访问域名:http://www.icodding.com/

报错404 Not Found,但是加上index.jsp就正常,为什么?(注:通过IP+9080/8080不加index.jsp可以正常访问)

https://img1.sycdn.imooc.com//szimg/5b1df65200016be407380192.jpg

但是输入:http://www.icodding.com/index.jsp

是可以正常访问的

https://img1.sycdn.imooc.com//szimg/5b1df6840001465c05820275.jpg

正在回答 回答被采纳积分+3

5回答

提问者 老菜鸟的修炼 2018-06-20 20:06:37

再补充下默认配置文件nginx.conf的完整配置信息:

//img1.sycdn.imooc.com//szimg/5b2a434b00018cd804050440.jpg

0 回复 有任何疑惑可以回复我~
qq_就是这样_8 2018-06-20 17:45:35

请问你解决了吗,我也遇到这个问题,而且访问host/index.jsp页面时空白的

0 回复 有任何疑惑可以回复我~
  • 提问者 老菜鸟的修炼 #1
    没有。。。。还在等老师
    回复 有任何疑惑可以回复我~ 2018-06-20 20:07:58
提问者 老菜鸟的修炼 2018-06-17 22:45:29

这是vhost下的自定义配置文件的完整信息

https://img1.sycdn.imooc.com//szimg/5b2a44b20001ffd305550503.jpg

0 回复 有任何疑惑可以回复我~
Geely 2018-06-17 16:12:30

你好,亲爱的同学,那就是nginx的首页没有找到,nginx的首页转发配置的是什么呢,现在?

看你的情况,tomcat是ok的,然后nginx也是ok的,那就出在nginx转发到tomcat这个配置上。

发上来我们一起看一下。

0 回复 有任何疑惑可以回复我~
  • 提问者 老菜鸟的修炼 #1
    upstream icodding{
            server 127.0.0.1:8080 weight=1;
            server 127.0.0.1:9080 weight=2;
    }
    
    server {
    listen 80;
    autoindex on;
    server_name icodding.com www.icodding.com;
    access_log /usr/local/nginx/logs/access.log combined;
    index index.jsp 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://127.0.0.1:8080/;
             proxy_pass http://icodding;
             }
    
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
           # proxy_pass http://127.0.0.1:8080;
    回复 有任何疑惑可以回复我~ 2018-06-17 22:44:44
  • location = / {
            root /product/front/mmall_fe/dist/view;
            index index.html;
    }
    应该是这个不对吧
    回复 有任何疑惑可以回复我~ 2018-06-20 17:49:22
  • 提问者 老菜鸟的修炼 #3
    老师,首页是在哪配置.......是默认的nginx.conf吗?
    回复 有任何疑惑可以回复我~ 2018-06-20 20:03:18
loubobooo 2018-06-11 22:53:25

应该是你Nginx代理的有问题

0 回复 有任何疑惑可以回复我~
  • 提问者 老菜鸟的修炼 #1
    已经补充了完整的配置信息,能否帮具体分析下。。。。。。
    回复 有任何疑惑可以回复我~ 2018-06-20 20:15:39
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信