Update nginx.dist.conf
Copy-paste rule for nginx configuration in action. Isolate locations with regular expressions.
This commit is contained in:
parent
e2073eaba5
commit
0e09dc7202
1 changed files with 57 additions and 18 deletions
|
@ -7,6 +7,7 @@ server {
|
|||
root "/www/forkbb/public"; # you need to set your values
|
||||
autoindex off;
|
||||
charset utf-8;
|
||||
server_tokens off;
|
||||
|
||||
location = /favicon.ico {
|
||||
access_log off;
|
||||
|
@ -20,24 +21,8 @@ server {
|
|||
log_not_found off;
|
||||
}
|
||||
|
||||
location ~ ^/(js|img|style)/(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
|
||||
try_files /$1/$2.$3 =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
|
||||
location ~ ^/(js|img|style)/ {
|
||||
try_files $uri =404;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
deny all;
|
||||
|
||||
access_log off;
|
||||
log_not_found off;
|
||||
}
|
||||
|
||||
location / {
|
||||
fastcgi_hide_header X-Powered-By;
|
||||
fastcgi_index index.dist.php;
|
||||
|
||||
include fastcgi_params;
|
||||
|
@ -46,6 +31,60 @@ server {
|
|||
fastcgi_param SCRIPT_FILENAME $realpath_root/index.dist.php;
|
||||
fastcgi_param DOCUMENT_ROOT $realpath_root;
|
||||
|
||||
fastcgi_pass unix:/var/run/php-fpm.sock; # you need to set your values
|
||||
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;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location ~ \.(css|js|gif|png|jpg|jpeg|webp)$ {
|
||||
try_files $uri =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
}
|
||||
|
||||
location /img/ {
|
||||
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
|
||||
try_files $1.$2 =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location ~ \.(css|js|gif|png|jpg|jpeg|webp)$ {
|
||||
try_files $uri =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
}
|
||||
|
||||
location /style/ {
|
||||
location ~ ^(.+)\.v\.[0-9]+\.([^.\\/]++)$ {
|
||||
try_files $1.$2 =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
|
||||
location ~ /\.ht {
|
||||
return 404;
|
||||
}
|
||||
|
||||
location ~ \.(css|js|gif|png|jpg|jpeg|webp)$ {
|
||||
try_files $uri =404;
|
||||
|
||||
expires 1y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue