nginx vue项目代理二级目录报404

server
{
    listen 8081;
    listen [::]:8081;

    index index.php index.html index.htm default.php default.htm default.html;
    root /home/pms/www/console;
  
    
    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log /dev/null;
    }


    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log /dev/null; 
    }
     location /api/ {
            proxy_pass http://192.168.124.231:8601;
        }
         location /yiyuanjuan/ {
            proxy_pass http://192.168.124.231:8703; 
        }

 
     location / {
      try_files $uri $uri/ /index.html;
    }
    access_log  /www/wwwlogs/dev.wenwenmao.com.log;
    error_log  /www/wwwlogs/dev.wenwenmao.com.error.log;
}

我设置二级目录名叫yiyuanjuan
http://192.168.124.234:8081/yiyuanjuan/#/
一级是http://192.168.124.234:8081
但是如果在

       location /yiyuanjuan/ {
            proxy_pass http://192.168.124.231:8703; 
        }

配置代理ip 就报404错误

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Sat Apr 20 19:55:50 CST 2019
There was an unexpected error (type=Not Found, status=404).
Not Found

折腾了半天也不懂是什么原因
我希望一级目录代理8601的
二级目录代理8703

经过晚上分析一下 我隐射到接口那边了。。只是二级目录为什么打不开呢,反正隐射到接口地址请求?
阅读 6.2k
1 个回答

clipboard.png

clipboard.png

你可以参考我这个配置selfcome是vue项目 mode:history模式 设置了try_files

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题