NGINX reverse proxy
-
I have switched to NGINX reverse proxy after poor results with LiteSpeed.
I understood W3 Total Cache generates an nginx.conf file at the root of the wordpress install. I cannot find this.
Could you please advise me on this?
Thanks
-
Hello @plan9
Thank you for reaching out and I am happy to assist you with this.
This depends on where WordPress is installed. The main nginx.conf should be located in /etc/nginx/nginx.conf
There should also be an nginx.conf in the root of your website installation.
W3TC may create the nginx.conf id it does not exist and the created one (if needed) is located at the root of your website.
You can also check this in the plugin in Performance>Install. There you can see the rewrite rules and the location of the nginx.conf.
I hope this helps!
Thnaks!Hello
Thanks for your reply. I can see the main nginx.conf located at /etc/nginx/nginx.conf
I can’t find any nginx.conf at the web root of the wordpress site – and no mention of nginx.conf in Performance & Install.
I don’t know if it is related but in the compatibility check it also lists all the apache mods as not detected, eg: mod_deflate: Not detected (required for disk enhanced Page Cache and Browser Cache)
This was not the case before installing NGINX reverse proxy.
I am seeing ‘Nginx’ in the headers, so the reverse proxy is working. It just doesn’t look like W3 Total Cache is aware of it.
Hello @plan9
Thank you for reaching out.
I am not quite sure what do you mean by the statement:reverse proxy is working. It just doesn’t look like W3 Total Cache is aware of it.
mod_deflate is an Apache module, so if you are on an Apache server and using nginx proxy, this is not related to W3 Total Cache as W3 Total Cache adds the rules for the server env.
Can you please enable the option Set W3 Total Cache header in Performance>Browser Cache, save all settings and purge the cache and share the website URL?
Thanks!Hi
I am not quite sure what do you mean by the statement:
reverse proxy is working. It just doesn’t look like W3 Total Cache is aware of it.
OK – so W3 Total Cache only adds a config file when NGINX is used as the server – not used as reverse proxy for Apache?
Here are example headers from the same server:
Request URL: https://hub.site.com/alex/2021/11/12/my-first-post/ Request Method: GET Status Code: 200 Remote Address: 88.422.28.16:443 Referrer Policy: no-referrer-when-downgrade cache-control: max-age=3600, public content-encoding: gzip content-type: text/html; charset=UTF-8 date: Fri, 04 Feb 2022 16:38:45 GMT etag: W/"b036a2b04f0c6d8330965e6619cddb4e" last-modified: Fri, 04 Feb 2022 16:38:18 GMT link: <https://hub.site.com/alex/wp-json/>; rel="https://api.w.org/", <https://hub.site.com/alex/wp-json/wp/v2/posts/37>; rel="alternate"; type="application/json", <https://hub.site.com/alex/?p=37>; rel=shortlink pragma: public referrer-policy: no-referrer-when-downgrade server: nginx vary: X-Forwarded-Proto,Accept-Encoding x-pingback: https://hub.site.com/alex/xmlrpc.php x-powered-by: W3 Total Cache/2.2.1 :authority: hub.site.com :method: GET :path: /alex/2021/11/12/my-first-post/ :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-GB,en;q=0.9 cache-control: no-cache cookie: wordpress_test_cookie=WP+Cookie+check; wp_lang=en_GB; _ga=GA1.2.1656508639.1635758655; cookielawinfo-checkbox-necessary=yes; cookielawinfo-checkbox-functional=yes; cookielawinfo-checkbox-performance=yes; cookielawinfo-checkbox-analytics=yes; cookielawinfo-checkbox-advertisement=yes; cookielawinfo-checkbox-others=yes; CookieLawInfoConsent=eyJuZWNlc3NhcnkiOnRydWUsImZ1bmN0aW9uYWwiOnRydWUsInBlcmZvcm1hbmNlIjp0cnVlLCJhbmFseXRpY3MiOnRydWUsImFkdmVydGlzZW1lbnQiOnRydWUsIm90aGVycyI6dHJ1ZX0=; viewed_cookie_policy=yes pragma: no-cache referer: https://hub.site.com/alex/ sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: same-origin sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
Request URL: https://hub.site.com/alex/2021/11/12/my-first-post/ Request Method: GET Status Code: 200 Remote Address: 87.76.28.42:443 Referrer Policy: no-referrer-when-downgrade cache-control: max-age=3600, public content-encoding: gzip content-type: text/html; charset=UTF-8 date: Fri, 04 Feb 2022 16:38:45 GMT etag: W/"b036a2b04f0c6dh578ur65e6619cddb4e" last-modified: Fri, 04 Feb 2022 16:38:18 GMT link: <https://hub.site.com/alex/wp-json/>; rel="https://api.w.org/", <https://hub.site.com/alex/wp-json/wp/v2/posts/37>; rel="alternate"; type="application/json", <https://hub.site.com/alex/?p=37>; rel=shortlink pragma: public referrer-policy: no-referrer-when-downgrade server: nginx vary: X-Forwarded-Proto,Accept-Encoding x-pingback: https://hub.site.com/alex/xmlrpc.php x-powered-by: W3 Total Cache/2.2.1 :authority: hub.site.com :method: GET :path: /alex/2021/11/12/my-first-post/ :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9 accept-encoding: gzip, deflate, br accept-language: en-GB,en;q=0.9 cache-control: no-cache cookie: wordpress_test_cookie=WP+Cookie+check; wp_lang=en_GB; _ga=GA1.2.1656508639.1635757270; cookielawinfo-checkbox-necessary=yes; cookielawinfo-checkbox-functional=yes; cookielawinfo-checkbox-performance=yes; cookielawinfo-checkbox-analytics=yes; cookielawinfo-checkbox-advertisement=yes; cookielawinfo-checkbox-others=yes; CookieLawInfoConsent=eyJuZWNlc3NhcnkiOfgoerngswtmZ1bmN0aW9uYWwiOnRydWUsInBlcmZvcm1hbmNlIjp0cnVlLCJhbmFseXRpY3MiOnRydWUsImFkdmVysfhuybnQiOnRydWUsIm90aGVycyI6dHJ1ZX0=; viewed_cookie_policy=yes pragma: no-cache referer: https://hub.site.com/alex/ sec-ch-ua: " Not;A Brand";v="99", "Google Chrome";v="97", "Chromium";v="97" sec-ch-ua-mobile: ?0 sec-ch-ua-platform: "macOS" sec-fetch-dest: document sec-fetch-mode: navigate sec-fetch-site: same-origin sec-fetch-user: ?1 upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36
- This reply was modified 2 years, 9 months ago by George M.
Hello @plan9
Yes, this is correct. Your website is on Apache using Nginx as a Proxy.
W3TC will only add rules for .htaccess as it detects the Apache server.
As you can see, Cache-control, Gzip, Etag, Last modified, and x-powered-by are all added by W3 Total Cache.Thanks!
Hello @vmarko
Oh great. So everything is working as expected? The NGINX reverse proxy cache is a bit strange as there are no controls apart from emptying the cache.
If I keep W3TC handling the page cache will this be slower than just letting NGINX cache the pages? I read somewhere that W3TC enhanced disk caching still needs to use PHP. Is that correct?
Hello @plan9
Yes as I can see everything is working as expected.
A proxy server is a go?between or intermediary server that forwards requests for content from multiple clients to different servers across the Internet. When you are using Proxy and W3TC it’s much faster than only using an Nginx proxy.
And no, Disk: Enhanced serves cached pages using the server’s URL rewriting capabilities, skipping PHP and WordPress entirely. It’s faster and more efficient.
Thanks!Thanks @vmarko
I really appreciate your help.
Using Apache + NGINX reverse proxy + W3 Total Cache I am seeing much better results than I ever did with LiteSpeed server (which I was paying for).
@vmarko Done!
- The topic ‘NGINX reverse proxy’ is closed to new replies.