Skip to content

Commit 522b750

Browse files
author
Alexandros Ioannides
authored
Update wordpress.tpl
1 parent 0fcdcee commit 522b750

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

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

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ server {
1111
access_log /var/log/nginx/domains/%domain%.log combined;
1212
access_log /var/log/nginx/domains/%domain%.bytes bytes;
1313
error_log /var/log/nginx/domains/%domain%.error.log error;
14-
14+
1515
include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
16-
16+
1717
location = /favicon.ico {
1818
log_not_found off;
1919
access_log off;
@@ -25,49 +25,49 @@ server {
2525
access_log off;
2626
}
2727

28+
location ~ /\.(?!well-known\/) {
29+
deny all;
30+
return 404;
31+
}
32+
33+
location ~* /(?:uploads|files)/.*.php$ {
34+
deny all;
35+
return 404;
36+
}
37+
2838
location / {
2939
try_files $uri $uri/ /index.php?$args;
30-
31-
if (!-e $request_filename)
32-
{
33-
rewrite ^(.+)$ /index.php?q=$1 last;
34-
}
35-
36-
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
37-
expires max;
40+
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)$ {
41+
expires 30d;
3842
fastcgi_hide_header "Set-Cookie";
3943
}
4044

4145
location ~ [^/]\.php(/|$) {
4246
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
43-
if (!-f $document_root$fastcgi_script_name) {
44-
return 404;
45-
}
46-
47-
fastcgi_pass %backend_lsnr%;
48-
fastcgi_index index.php;
47+
try_files $uri =404;
48+
fastcgi_pass %backend_lsnr%;
49+
fastcgi_index index.php;
4950
include /etc/nginx/fastcgi_params;
50-
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
51+
include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
52+
if ($request_uri ~* "/wp-admin/|wp-.*.php|xmlrpc.php|index.php|/store.*|/cart.*|/my-account.*|/checkout.*") {
53+
set $no_cache 1;
54+
}
55+
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") {
56+
set $no_cache 1;
57+
}
5158
}
5259
}
5360

5461
location /error/ {
5562
alias %home%/%user%/web/%domain%/document_errors/;
5663
}
5764

58-
location ~ /\.(?!well-known\/) {
59-
deny all;
60-
return 404;
61-
}
62-
6365
location /vstats/ {
6466
alias %home%/%user%/web/%domain%/stats/;
6567
include %home%/%user%/web/%domain%/stats/auth.conf*;
6668
}
6769

68-
include /etc/nginx/conf.d/phpmyadmin.inc*;
69-
include /etc/nginx/conf.d/phppgadmin.inc*;
70-
include /etc/nginx/conf.d/webmail.inc*;
71-
72-
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
70+
include /etc/nginx/conf.d/phpmyadmin.inc*;
71+
include /etc/nginx/conf.d/phppgadmin.inc*;
72+
include %home%/%user%/conf/web/%domain%/nginx.conf_*;
7373
}

0 commit comments

Comments
 (0)