wordpress_mu_subdir.tpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #=========================================================================#
  2. # Default Web Domain Template #
  3. # DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS #
  4. # https://hestiacp.com/docs/server-administration/web-templates.html #
  5. #=========================================================================#
  6. server {
  7. listen %ip%:%web_port%;
  8. server_name %domain_idn% %alias_idn%;
  9. root %docroot%;
  10. index index.php index.html index.htm;
  11. access_log /var/log/nginx/domains/%domain%.log combined;
  12. access_log /var/log/nginx/domains/%domain%.bytes bytes;
  13. error_log /var/log/nginx/domains/%domain%.error.log error;
  14. include %home%/%user%/conf/web/%domain%/nginx.forcessl.conf*;
  15. # Rewrite requests to /wp-.* on subdirectory installs.
  16. if (!-e $request_filename) {
  17. rewrite /wp-admin$ $scheme://$host$uri/ permanent;
  18. rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
  19. rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
  20. }
  21. location = /favicon.ico {
  22. log_not_found off;
  23. access_log off;
  24. }
  25. location = /robots.txt {
  26. try_files $uri $uri/ /index.php?$args;
  27. log_not_found off;
  28. access_log off;
  29. }
  30. location ~ /\.(?!well-known\/) {
  31. deny all;
  32. return 404;
  33. }
  34. location / {
  35. try_files $uri $uri/ /index.php?$args;
  36. location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
  37. expires 30d;
  38. fastcgi_hide_header "Set-Cookie";
  39. }
  40. location ~* /(?:uploads|files)/.*.php$ {
  41. deny all;
  42. return 404;
  43. }
  44. location ~ [^/]\.php(/|$) {
  45. try_files $uri =404;
  46. include /etc/nginx/fastcgi_params;
  47. fastcgi_index index.php;
  48. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  49. fastcgi_param HTTP_HOST $host;
  50. fastcgi_pass %backend_lsnr%;
  51. include %home%/%user%/conf/web/%domain%/nginx.fastcgi_cache.conf*;
  52. if ($request_uri ~* "/wp-admin/|/wp-json/|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. }
  58. }
  59. }
  60. location /error/ {
  61. alias %home%/%user%/web/%domain%/document_errors/;
  62. }
  63. location /vstats/ {
  64. alias %home%/%user%/web/%domain%/stats/;
  65. include %home%/%user%/web/%domain%/stats/auth.conf*;
  66. }
  67. include /etc/nginx/conf.d/phpmyadmin.inc*;
  68. include /etc/nginx/conf.d/phppgadmin.inc*;
  69. include %home%/%user%/conf/web/%domain%/nginx.conf_*;
  70. }