前端的nginx配置

109 阅读1分钟
server {    
    listen       4002;        
    server_name  localhost;        
    location / {            
        root   /usr/local/4002;            
        try_files $uri $uri/  /index.html;            
        index  index.html index.htm;        
    }       
     location /admin {         
        #添加访问目录为/apis的代理配置          
        proxy_pass   http://user-admin.farmtruth.cn/index.php;          
        # proxy_pass   http://118.25.184.229/index.php;        
    }        
    location /wxaapi { #添加访问目录为/apis的代理配置          
        proxy_pass   https://api.weixin.qq.com/wxaapi;        
    }        
    location /media { 
        #添加访问目录为/apis的代理配置          
        proxy_pass   https://api.weixin.qq.com/cgi-bin;          
    }        
    location /wxa { #添加访问目录为/apis的代理配置         
        proxy_pass   https://api.weixin.qq.com/wxa;     
    }                 
    error_page   500 502 503 504  /50x.html;        
    location = /50x.html {            
    root   html;        
    }    
}

配置vue-router模式

index  index.html index.htm;

如果还有问题,检测代码配置

assetsPublicPath: '/',