32 lines
854 B
Nginx Configuration File
32 lines
854 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
#access_log /var/log/nginx/host.access.log main;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# 缓存静态资源
|
|
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg)$ {
|
|
root /usr/share/nginx/html;
|
|
expires 30d;
|
|
}
|
|
|
|
# 压缩文本文件提高性能
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_min_length 10240;
|
|
gzip_proxied expired no-cache no-store private auth;
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/javascript;
|
|
gzip_disable "MSIE [1-6]\.";
|
|
|
|
# 处理错误页面
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
} |