46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /usr/share/nginx/html;
|
|
index index.html index.htm index.php;
|
|
|
|
gzip on;
|
|
gzip_min_length 1k;
|
|
gzip_buffers 4 16k;
|
|
gzip_http_version 1.1;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/svg+xml;
|
|
gzip_vary on;
|
|
|
|
location ~ \.php$ {
|
|
fastcgi_pass php:9000;
|
|
fastcgi_index index.php;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
fastcgi_connect_timeout 60s;
|
|
fastcgi_send_timeout 60s;
|
|
fastcgi_read_timeout 60s;
|
|
fastcgi_buffer_size 128k;
|
|
fastcgi_buffers 4 128k;
|
|
}
|
|
|
|
location / {
|
|
try_files $uri $uri/;
|
|
}
|
|
|
|
location /api/ {
|
|
try_files $uri $uri/;
|
|
}
|
|
|
|
# 静态资源长期缓存
|
|
location ~* \.(jpg|jpeg|png|gif|webp|ico)$ {
|
|
expires 7d;
|
|
add_header Cache-Control "public, max-age=604800";
|
|
access_log off;
|
|
}
|
|
location ~* \.(js|css|woff|woff2|ttf)$ {
|
|
expires 3d;
|
|
add_header Cache-Control "public, max-age=259200";
|
|
access_log off;
|
|
}
|
|
}
|