1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-02-03 02:23:38 +08:00
Files
408CSFamily/nginx.conf
2023-02-01 23:51:01 +08:00

44 lines
1.7 KiB
Nginx Configuration File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 参考https://www.likecs.com/ask-1256888.html
user root;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile off;
access_log off; ## 关闭正常访问日志
keepalive_timeout 3000;
server {
listen 80;
server_name localhost;
#access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log error;
## 静态资源代理
location / {
gzip on; #开启或关闭gzip on off
gzip_disable "msie6"; #不使用gzip IE6
gzip_min_length 100k; #gzip压缩最小文件大小超出进行压缩自行调节
gzip_buffers 4 16k; #buffer 不用修改
gzip_comp_level 8; #压缩级别:1-10数字越大压缩的越好时间也越长
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; # 压缩文件类型
# root 根目录默认nginx镜像的html文件夹可以指定其他
root /usr/share/nginx/html;
index index.html index.htm;
# 如果vue-router使用的是history模式需要设置这个
try_files $uri $uri/ /index.html;
}
## 错误页面
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}