wordpress-disable-xmlrpc.tpl 2.4 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. location = /favicon.ico {
  16. log_not_found off;
  17. access_log off;
  18. }
  19. location = /robots.txt {
  20. try_files $uri $uri/ /index.php?$args;
  21. log_not_found off;
  22. access_log off;
  23. }
  24. location ~ /\.(?!well-known\/) {
  25. deny all;
  26. return 404;
  27. }
  28. location / {
  29. try_files $uri $uri/ /index.php?$args;
  30. 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)$ {
  31. expires 30d;
  32. fastcgi_hide_header "Set-Cookie";
  33. }
  34. location ~* /(?:uploads|files)/.*.php$ {
  35. deny all;
  36. return 404;
  37. }
  38. location = /xmlrpc.php {
  39. deny all;
  40. access_log off;
  41. log_not_found off;
  42. return 403;
  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. }