Nginx: put include webapps.conf & CUSTOM3 before LOCATION_BLOCKS, EXTRA_LOCATIONS (TEMPLATES)

Version 1.62.9


The nginx_server.conf templates include the webapps config near the end of the server{} block: include /etc/nginx/webapps.conf; and: include /etc/nginx/webapps.ssl.conf; We' just make reference to webapps.conf for documentation simplicity here. If the User has added a WordPress Nginx Template to the / location, this would match /webmail before getting to the webapps include, causing a 404 on /webmail. ==================== SOLUTION: Move the 2 lines: |CUSTOM3| include /etc/nginx/webapps.conf; higher up in the output, before LOCATION_BLOCKS, and after HOTLINK_PROTECTION, eg: |*if HAVE_NGINX_PROXY="1"| ... |*else| |NGINX_REDIRECTS| |HOTLINK_PROTECTION| |*endif| |CUSTOM3| include /etc/nginx/webapps.conf; |*if HAVE_NGINX_PROXY!="1"| |LOCATION_BLOCKS| |EXTRA_LOCATIONS| |*endif| |MOD_SECURITY_RULES| Here is the previous layout before the above change: |*if HAVE_NGINX_PROXY="1"| ... |*else| |NGINX_REDIRECTS| |HOTLINK_PROTECTION| |LOCATION_BLOCKS| |EXTRA_LOCATIONS| |*endif| |MOD_SECURITY_RULES| |CUSTOM3| include /etc/nginx/webapps.conf; ==================== TEMPLATES The following 4 templates have the above change: nginx_server.conf nginx_server_secure.conf nginx_server_sub.conf nginx_server_secure_sub.conf (where webapps.ssl.conf is used for nginx_server_secure*.conf instances) ---- T35292

Interested to try DirectAdmin? Get a 30-day Free Trial!