40 lines
1018 B
Plaintext
40 lines
1018 B
Plaintext
server {
|
||
listen 80;
|
||
server_name localhost;
|
||
|
||
#gzip config
|
||
gzip on;
|
||
gzip_buffers 32 4k;
|
||
gzip_comp_level 6;
|
||
gzip_min_length 100;
|
||
gzip_types application/javascript text/css text/xml;
|
||
gzip_disable "MSIE [1-6]\."; #配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
|
||
gzip_vary on;
|
||
|
||
location / {
|
||
root /usr/share/nginx/html;
|
||
index index.html index.htm;
|
||
try_files $uri $uri/ /index.html;
|
||
|
||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, immutable";
|
||
}
|
||
}
|
||
|
||
location ~ ^/dev-api/(?<path>.*) {
|
||
proxy_pass http://192.168.1.12:18080/$path$is_args$args;
|
||
|
||
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_set_header X-Forwarded-Proto $scheme;
|
||
}
|
||
|
||
location /nginx-health {
|
||
access_log off;
|
||
return 200 "OK";
|
||
add_header Content-Type text/plain;
|
||
}
|
||
}
|