nginx配置前后端分离

server {
        listen       80;
        server_name admin.simikongjian.xin;
        root        /home/wwwroot/admin.simikongjian.xin;
        index  index.htm index.html index.php ;
        location /server {
        index index.html;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://admin.shopservice.cn/;
        }

        location /apim {
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://wiki.shopservice.cn:8001/;
        }

        location ~.*\.(gif|jpg|jpeg|png|bmp|swf|mp4)$ {
        proxy_pass http://admin.shopservice.cn;
        }

        location / {
        try_files $uri $uri/ @router;
        index index.html;
        }
        location @router {
        rewrite ^.*$ /index.html last;
        }
        location ^~ /src/ {
                alias /home/wwwroot/admin.simikongjian.xin/dist/;
                expires 7d;
        }

        access_log /home/wwwlogs/admin.simikongjian.xin.log;
}

猜你喜欢

转载自blog.csdn.net/myischenxiaohua/article/details/80857291