Virtualmin Apache + php7.4-fpm + reverse proxy Nginx guide

Hello, can you please make a guide to put apache + php7.4-fpm + reverse proxy Nginx in ubuntu 20.04

The reference in this forum is very old (obsolete), for ubuntu 16.04 and does not cover combos for both ubuntu 20.04 or for use with php7.4-fpm (obviously for https, ssl 443)

Thank you

Nginx
location / {
proxy_pass http://127.0.0.1:98798/;
proxy_http_version 1.1;
proxy_set_header Connection “upgrade”;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;

# by default nginx times out connections in one minute
proxy_read_timeout 1d;

}

Apache

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/socket.io [NC]
RewriteCond %{QUERY_STRING} transport=websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:98798/$1 [P,L]

RequestHeader set “X-Forwarded-Proto” expr=%{REQUEST_SCHEME}
ProxyVia On
ProxyRequests Off
ProxyAddHeaders On
ProxyPass / http://127.0.0.1:98798/
ProxyPassReverse / http://127.0.0.1:98798/

By default Apache times out connections after one minute

ProxyTimeout 86400 # 1 day

hope this settings help you . im using for apache reverse proxy

2 Likes

That’s too many web servers. If you want nginx performance/efficiency use nginx. If you need Apache features use Apache. Using both gives you the worst of each and the best of none.

1 Like

Thanks for the reply, it gives me a little idea (in the case of apache and nginx installer but not managed by virtualmin) i.e. the question would be how to add that via virtualmin. I’m confused.

So from your point of view if that’s not a good idea, would it be better to use Varnish? And in that case, what would be the procedure to integrate it with ssl 443?

Could you start a new topic for Apache + php7.4-FPM + Varnish please.

What are you trying to accomplish? It sounds like you just want more web servers in the path, which doesn’t make sense.

Anybody brave enough to run Apache and Nginx on the same server probably has Varnish, Squid or HAProxy in front of them.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.