Skip to content

Commit 0fcdcee

Browse files
author
Alexandros Ioannides
authored
Update wordpress.stpl
1 parent 0409454 commit 0fcdcee

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

install/deb/templates/web/nginx/php-fpm/wordpress.stpl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,49 +30,49 @@ server {
3030
access_log off;
3131
}
3232

33-
location / {
34-
try_files $uri $uri/ /index.php?$args;
33+
location ~ /\.(?!well-known\/) {
34+
deny all;
35+
return 404;
36+
}
3537

36-
if (!-e $request_filename)
37-
{
38-
rewrite ^(.+)$ /index.php?q=$1 last;
39-
}
38+
location ~* /(?:uploads|files)/.*.php$ {
39+
deny all;
40+
return 404;
41+
}
4042

41-
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
42-
expires max;
43+
location / {
44+
try_files $uri $uri/ /index.php?$args;
45+
location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
46+
expires 30d;
4347
fastcgi_hide_header "Set-Cookie";
4448
}
4549

4650
location ~ [^/]\.php(/|$) {
4751
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
48-
if (!-f $document_root$fastcgi_script_name) {
49-
return 404;
50-
}
51-
52-
fastcgi_pass %backend_lsnr%;
53-
fastcgi_index index.php;
52+
try_files $uri =404;
53+
fastcgi_pass %backend_lsnr%;
54+
fastcgi_index index.php;
5455
include /etc/nginx/fastcgi_params;
55-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
56+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
57+
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
58+
set $no_cache 1;
59+
}
60+
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in|woocommerce_items_in_cart|woocommerce_cart_hash|PHPSESSID") {
61+
set $no_cache 1;
62+
}
5663
}
5764
}
5865

5966
location /error/ {
6067
alias %home%/%user%/web/%domain%/document_errors/;
6168
}
6269

63-
location ~ /\.(?!well-known\/) {
64-
deny all;
65-
return 404;
66-
}
67-
6870
location /vstats/ {
6971
alias %home%/%user%/web/%domain%/stats/;
7072
include %home%/%user%/web/%domain%/stats/auth.conf*;
7173
}
7274

73-
include /etc/nginx/conf.d/phpmyadmin.inc*;
74-
include /etc/nginx/conf.d/phppgadmin.inc*;
75-
include /etc/nginx/conf.d/webmail.inc*;
76-
77-
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
75+
include /etc/nginx/conf.d/phpmyadmin.inc*;
76+
include /etc/nginx/conf.d/phppgadmin.inc*;
77+
include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
7878
}

0 commit comments

Comments
 (0)