From f30dab8c69e26942392aab503d3c70950a300b60 Mon Sep 17 00:00:00 2001 From: Piotr Jasiek Date: Sun, 21 May 2017 01:14:54 +0200 Subject: [PATCH] Add to template wordpress2 rewrite for worpress Without my changes i can use only http://example.com/?id=1 like on this site: http://napartments.pl/?page_id=162 after changes i can use http://example.com/post_name like on my site: https://s-m-s.pl/kontakt/. I want add new template because i thin rewrite is additional setting. --- .../web/nginx/php5-fpm/wordpress2_rewrite.tpl | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 install/debian/8/templates/web/nginx/php5-fpm/wordpress2_rewrite.tpl diff --git a/install/debian/8/templates/web/nginx/php5-fpm/wordpress2_rewrite.tpl b/install/debian/8/templates/web/nginx/php5-fpm/wordpress2_rewrite.tpl new file mode 100644 index 000000000..39e366b73 --- /dev/null +++ b/install/debian/8/templates/web/nginx/php5-fpm/wordpress2_rewrite.tpl @@ -0,0 +1,67 @@ +server { + listen %ip%:%web_port%; + server_name %domain_idn% %alias_idn%; + root %docroot%; + index index.php index.html index.htm; + access_log /var/log/nginx/domains/%domain%.log combined; + access_log /var/log/nginx/domains/%domain%.bytes bytes; + error_log /var/log/nginx/domains/%domain%.error.log error; + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location / { + try_files $uri $uri/ /index.php?$args; + + if (!-e $request_filename) + { + rewrite ^(.+)$ /index.php?q=$1 last; + } + + location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ { + expires max; + } + + location ~ [^/]\.php(/|$) { + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + + fastcgi_pass %backend_lsnr%; + fastcgi_index index.php; + include /etc/nginx/fastcgi_params; + } + } + + error_page 403 /error/404.html; + error_page 404 /error/404.html; + error_page 500 502 503 504 /error/50x.html; + + location /error/ { + alias %home%/%user%/web/%domain%/document_errors/; + } + + location ~* "/\.(htaccess|htpasswd)$" { + deny all; + return 404; + } + + location /vstats/ { + alias %home%/%user%/web/%domain%/stats/; + include %home%/%user%/web/%domain%/stats/auth.conf*; + } + + include /etc/nginx/conf.d/phpmyadmin.inc*; + include /etc/nginx/conf.d/phppgadmin.inc*; + include /etc/nginx/conf.d/webmail.inc*; + + include %home%/%user%/conf/web/nginx.%domain_idn%.conf*; +}