{"id":2160,"date":"2026-08-30T12:05:25","date_gmt":"2026-08-30T11:05:25","guid":{"rendered":"https:\/\/www.hutsky.cz\/blog\/?p=2160"},"modified":"2026-08-30T12:05:26","modified_gmt":"2026-08-30T11:05:26","slug":"apache-2-4-as-a-reverse-proxy-for-wordpress","status":"publish","type":"post","link":"https:\/\/www.hutsky.cz\/blog\/2026\/08\/apache-2-4-as-a-reverse-proxy-for-wordpress\/","title":{"rendered":"Apache 2.4 as a reverse proxy for WordPress"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I know that Nginx is sometimes regarded to be the cool web server option while Apache is at times considered to be somewhat old, slow. I don&#8217;t necessarily share this perception. To me, an Apache instance that&#8217;s only using a small set of modules is comparable to nginx, at least ever since it started supporting event driven approach. But it&#8217;s true that I&#8217;m not an expert when it comes to high volume web traffic, I only run this little blog of mine where Apache has no issues to deliver.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Performance aside, I&#8217;m still more inclined to use Apache anyway because to me, it&#8217;s an embodiment of an opensource-governed project and as such, it seems to me more likely that it will continue to exist and be well maintained in the long term. That being said, I do not mean to belittle Nginx in any way, it&#8217;s a great piece of software. I simply prefer Apache more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So even if it&#8217;s less common, I&#8217;m also using Apache as a reverse proxy occasionally. Like when there&#8217;s a WordPress instance running in a podman container in the background. But when I moved WordPress there originally, I ran into a couple of issues caused by the fact that client connection to Apache was HTTPS but the reverse proxy was talking to the container over plain HTTP. To remediate this I had to put the following at the top of wp-config.php:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>if ( (!empty( $_SERVER&#91;'HTTP_X_FORWARDED_HOST'])) || (!empty( $_SERVER&#91;'HTTP_X_FORWARDED_FOR'])) ) { $_SERVER&#91;'HTTPS'] = 'on'; }<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This basically checks &#8220;if either of those forwarded headers is present, this request came through the proxy&#8221; and so it manually informs WordPress that this was in fact a request coming through HTTPS.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Other that that, it works just fine. This is a typical proxy setup in case there is a container behind the proxy:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ProxyPreserveHost On\nRequestHeader set X-Forwarded-Proto \"https\"\nRequestHeader set X-Forwarded-Port \"443\"\nProxyPass \/  http:\/\/localhost:8081\/\nProxyPassReverse \/  http:\/\/localhost:8081\/<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Sometimes, I have a different use case where the proxy is forwarding requests to a completely different host, if that is a case, it&#8217;s as simple as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>SSLProxyEngine on\nProxyPass \"\/\" \"&lt;https:\/\/www.example.com\/\">\nProxyPassReverse \"\/\" \"&lt;https:\/\/www.example.com\/\"><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I know that Nginx is sometimes regarded to be the cool web server option while Apache is at times considered to be somewhat old, slow. I don&#8217;t necessarily share this perception. To me, an Apache instance that&#8217;s only using a &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/www.hutsky.cz\/blog\/2026\/08\/apache-2-4-as-a-reverse-proxy-for-wordpress\/\"> <span class=\"screen-reader-text\">Apache 2.4 as a reverse proxy for WordPress<\/span> Read more \u2192<\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[53,42],"class_list":["post-2160","post","type-post","status-publish","format-standard","hentry","category-web-related","tag-apache","tag-web"],"_links":{"self":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/2160","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/comments?post=2160"}],"version-history":[{"count":11,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/2160\/revisions"}],"predecessor-version":[{"id":2224,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/posts\/2160\/revisions\/2224"}],"wp:attachment":[{"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/media?parent=2160"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/categories?post=2160"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hutsky.cz\/blog\/wp-json\/wp\/v2\/tags?post=2160"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}