forkbb/nginx.dist.conf
2023-07-09 16:22:09 +07:00

118 lines
3 KiB
Text

#
# Example nginx configuration for forkbb
#
server {
listen 80; # 80 port only http:
server_name forkbb.local *.forkbb.local; # you need to set your values
root "/www/forkbb/public"; # you need to set your values
autoindex off;
charset utf-8;
server_tokens off;
location = /favicon.ico {
access_log off;
log_not_found off;
expires 1w;
etag off;
}
location = /robots.txt {
access_log off;
log_not_found off;
}
location / {
fastcgi_hide_header X-Powered-By;
fastcgi_index index.dist.php;
include fastcgi_params;
fastcgi_param HTTP_PROXY "";
#fastcgi_param SCRIPT_FILENAME $document_root/index.dist.php;
fastcgi_param SCRIPT_FILENAME $realpath_root/index.dist.php;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_pass php_upstream; # you need to set your values
#or fastcgi_pass unix:/var/run/php-fpm.sock; # you need to set your values
}
location /js/ {
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
try_files $1.$2 =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
location ~ /\.ht {
return 404;
}
location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
try_files $uri =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
}
location /img/ {
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
try_files $1.$2 =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
location ~ /\.ht {
return 404;
}
location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
try_files $uri =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
}
location /style/ {
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
try_files $1.$2 =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
location ~ /\.ht {
return 404;
}
location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
try_files $uri =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
}
location /upload/ {
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
try_files $1.$2 =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
location ~ /\.ht {
return 404;
}
location ~ \.(css|js|gif|png|jpg|jpeg|webp|avif|woff|woff2)$ {
try_files $uri =404;
add_header Cache-Control "public,max-age=31536000,immutable";
etag off;
}
}
}