50 lines
1.3 KiB
Nginx Configuration File
50 lines
1.3 KiB
Nginx Configuration File
![]() |
user nginx;
|
|||
|
worker_processes auto;
|
|||
|
pcre_jit on;
|
|||
|
error_log /dev/stderr;
|
|||
|
|
|||
|
|
|||
|
events {
|
|||
|
worker_connections 2000;
|
|||
|
}
|
|||
|
|
|||
|
http {
|
|||
|
include /etc/nginx/mime.types;
|
|||
|
default_type application/octet-stream;
|
|||
|
|
|||
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|||
|
'$status $body_bytes_sent "$http_referer" '
|
|||
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|||
|
|
|||
|
access_log /dev/stdout main;
|
|||
|
|
|||
|
sendfile on;
|
|||
|
keepalive_timeout 65;
|
|||
|
gzip on; # 开启gzip压缩
|
|||
|
gzip_vary on;
|
|||
|
gzip_proxied any;
|
|||
|
gzip_comp_level 6; # 压缩级别
|
|||
|
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript application/x-httpd-php image/jpeg image/gif image/png text/html;
|
|||
|
|
|||
|
server {
|
|||
|
listen 80;
|
|||
|
server_name _;
|
|||
|
|
|||
|
try_files $uri $uri/ /index.html;
|
|||
|
root /app/www;
|
|||
|
index index.html;
|
|||
|
|
|||
|
location /apple-app-site-association {
|
|||
|
add_header Content-Type application/json;
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
# 配置Nginx以提供预先压缩的.gz文件(如果存在)
|
|||
|
location ~* \.(js|css|json|txt|html|ico|svg)(\.gz)?$ {
|
|||
|
gzip_static on; # 优先提供.gz文件
|
|||
|
expires max;
|
|||
|
add_header Cache-Control public;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|