Latest way to get wordpress to work with ISPconfig and Nginx?

Discussion in 'Server Operation' started by PermaNoob, Mar 24, 2020.

  1. PermaNoob

    PermaNoob Member

    I just setup a new server using
    The Perfect Server - Debian 10 (Nginx, BIND, Dovecot, ISPConfig 3.1)
    and thought I'd check in case there is a new way get Wordpress to work with Nginx other than the Nginx directives and nginx.conf file, or if there is updated content for those?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    There are no changes in nginx.conf required. Just install ISPConfig as described in the perfect server guide and then put the Wordpress specific config snippet into Nginx directives field.
     
  3. PermaNoob

    PermaNoob Member

    Ok, what I have is 5 years old, just checking to make sure there are no changes:
    Nginx directive I have:

    ---------------------------
    location / {
    try_files $uri $uri/ /index.php?$args;
    }

    # Add trailing slash to */wp-admin requests.
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;

    location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ {
    expires max;
    log_not_found off;
    }

    include /var/www/mydomain.com/web/nginx.conf;

    location ~ /nginx.conf {
    deny all;
    access_log off;
    log_not_found off;
    }
    ---------------------------
    referring to nginx.conf in the web directory containing:
    ----------------------------
    # BEGIN W3TC Page Cache cache
    location ~ /wp-content/w3tc/pgcache.*html$ {
    add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    add_header Vary "Accept-Encoding, Cookie";
    }
    location ~ /wp-content/w3tc/pgcache.*gzip$ {
    gzip off;
    types {}
    default_type text/html;
    add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    add_header Vary "Accept-Encoding, Cookie";
    add_header Content-Encoding gzip;
    }
    # END W3TC Page Cache cache
    # BEGIN W3TC Browser Cache
    gzip on;
    gzip_types text/css application/x-javascript text/x-component text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon;
    location ~ \.(css|js|htc)$ {
    add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
    add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
    add_header X-Powered-By "W3 Total Cache/0.9.2.4";
    }
    # END W3TC Browser Cache
    # BEGIN W3TC Page Cache core
    rewrite ^(.*\/)?w3tc_rewrite_test$ $1?w3tc_rewrite_test=1 last;
    set $w3tc_rewrite 1;
    if ($request_method = POST) {
    set $w3tc_rewrite 0;
    }
    if ($query_string != "") {
    set $w3tc_rewrite 0;
    }
    if ($http_host != "mysite.de") {
    set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite2 1;
    if ($request_uri !~ \/$) {
    set $w3tc_rewrite2 0;
    }
    if ($request_uri ~* "(sitemap(_index)?\.xml(\.gz)?|[a-z0-9_\-]+-sitemap([0-9]+)?\.xml(\.gz)?)") {
    set $w3tc_rewrite2 1;
    }
    if ($w3tc_rewrite2 != 1) {
    set $w3tc_rewrite 0;
    }
    set $w3tc_rewrite3 1;
    if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|\/feed\/|wp-.*\.php|index\.php)") {
    set $w3tc_rewrite3 0;
    }
    if ($request_uri ~* "(wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
    set $w3tc_rewrite3 1;
    }
    if ($w3tc_rewrite3 != 1) {
    set $w3tc_rewrite 0;
    }
    if ($http_cookie ~* "(comment_author|wp\-postpass|wordpress_\[a\-f0\-9\]\+|wordpress_logged_in)") {
    set $w3tc_rewrite 0;
    }
    if ($http_user_agent ~* "(W3\ Total\ Cache/0\.9\.2\.4)") {
    set $w3tc_rewrite 0;
    }
    set $w3tc_ua "";
    set $w3tc_ref "";
    set $w3tc_ssl "";
    set $w3tc_enc "";
    if ($http_accept_encoding ~ gzip) {
    set $w3tc_enc _gzip;
    }
    set $w3tc_ext "";
    -------------------------------
     

Share This Page