nginx 配置例子

nginx 配置

配置文件上传大小

client_max_body_size  40m;

保存后 nginx -s reload 后还是不行,
解决:采用taskkill /f /im nginx.exe命令杀死进程,再stat nginx 就行了。。。

配置vue

server {
    listen       8192;
    server_name  suncereltd.6655.la;
    client_max_body_size 500m;
    proxy_max_temp_file_size 500m;

    location / {
       root   /home/water/suncere.direct.networking.water.frontend/dist/;
       try_files $uri $uri/ /index.html;
   }


    location /api/base/
  	{
  		proxy_pass http://localhost:4483;
  	}
  	location /api/business/
  	{
  		proxy_pass http://localhost:4483;
  	}
  	location /wwww/.*\.(docx|doc)
  	{
  		proxy_pass http://localhost:4483;
  	}
  	location ~ .*\.(docx)$
  	{
  	   #proxy_pass http://localhost:4483;
         root /home/water/water-direct/wwwroot/download/;
  	}
    #location ~ .*\.(docx)$
  	#{
  	#   proxy_pass http://localhost:4483;
  	#}
}

单个端口,用路径区分,配置2个vue项目

server {
    listen       8321;
    server_name  suncereltd.6655.la;

    location /map/ {
        # root   /home/tongchuan/dist;
        alias    /home/weifang/map/;
        index  index.html index.htm;
    }
    location / {
        root   /home/weifang/map/;
        index  index.html index.htm;
    }
    location /bs/ {
        # root   /home/tongchuan/dist;
        alias    /home/weifang/water/;
        index  index.html index.htm;
    }
    location /App_Data/AduitFiles/ {
       root   /home/weifang/webhost;
  	}

    location ^~ /static/outlet/ {
         rewrite ^/(.*) http://suncereltd.6655.la:8321/#/$1 last;
    }
    # location /api/ {
    #     proxy_pass   http://localhost:4402/api/;
    # }
    location /api/ {
        proxy_pass   http://localhost:8328/api/;
    }

}
上一篇:动态添加属性和方法


下一篇:C++使用条件运算符进行成绩分级