nginx启动vue项目,nginx.conf配置项

nginx.conf文件内容


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;
error_log  D:/enviroment/nginx-1.24.0/logs;

#pid        logs/nginx.pid;
pid        D:/enviroment/nginx-1.24.0/logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        listen 8081;
        server_name localhost;

        gzip on;
        gzip_static on;     # 需要http_gzip_static_module 模块
        gzip_min_length 1k;
        gzip_comp_level 4;
        gzip_proxied any;
        gzip_types text/plain text/xml text/css;
        gzip_vary on;
        gzip_disable "MSIE [1-6]\.(?!.*SV1)";

        root D:/gitStore/812/wms-ui/dist/;    

        location ^~/api/ {
            proxy_pass http://127.0.0.1:9999/; #注意/后缀
            proxy_connect_timeout 60s;
            proxy_read_timeout 120s;
            proxy_send_timeout 120s;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto http;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
        }
   
	}
}

你可能感兴趣的:(nginx,nginx,vue.js,运维)