Submitted by Murz on Fri, 06/16/2017 - 02:51
Very popular configuration is nginx as reverse proxy for apache for dynamic queries, and direct access for static content. At now Virtualmin don't allow to enable both - Apache and Nginx website with error:
Failed to modify server : Nginx cannot be enabled for a domain that also has an Apache website
This can be disabled via commenting /usr/share/webmin/virtualmin-nginx/virtual_feature.pl
file - line 66:
return $text{'feat_eapache'} if ($d->{'web'});
to
# return $text{'feat_eapache'} if ($d->{'web'});
Instead of this hack - will be good to have an option in Virtualmin configuration "Allow Nginx website together with - Apache website" - can you add it?
Status:
Active
Comments
Submitted by Murz on Fri, 06/16/2017 - 02:51 Comment #1
Submitted by Murz on Fri, 06/16/2017 - 02:52 Comment #2
Submitted by andreychek on Fri, 06/16/2017 - 09:25 Comment #3
Howdy -- we had received some requests for doing something similar with Varnish some time ago.
And while the configuration itself was a bit complicated to add into Virtualmin as a built-in feature, what we did is write up instructions on how to manually configure that.
However, Varnish has some disadvantages that are significant -- notably the idea that it doesn't do SSL... which is a big deal now that SSL is becoming more and more prevalent.
Out of curiosity, what kind of configuration are you doing to get things working after you enable both Apache and Nginx?
Submitted by Murz on Mon, 06/19/2017 - 04:14 Comment #4
Configuration is very classic and popular on shared hostings: Nginx give static content (txt, css, js, image files) and php queries proxies to Apache server.
Here is example of configuration: https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-...
Submitted by Murz on Fri, 09/01/2017 - 08:22 Comment #5
For solve this problem we must have separate web
ip:port
settings for Nginx virtualserver and Apache, compare it and and shows this error only when Apache & Nginxip:port
are equal.Submitted by JamieCameron on Sat, 09/02/2017 - 11:51 Comment #6
While I can understand why this setup is useful, it would take some work to properly support in Virtualmin as there are strong assumptions in the code that only one webserver is active (and needs to be configured) at a time.
Submitted by Murz on Sun, 09/03/2017 - 09:05 Comment #7
At now this configuration works well on my 2 webservers when I change one line in Virtualmin script. The problem is that nginx & apache need 2 different port, but I configure post-save script that replace port for Nginx to needed.
This configuration with both apache+nginx on one server - is very popular, you can see many manuals by googling "nginx apache proxy", so Nginx give directly static content (files) and proxies dynamic content to apache backend.
For add ability to configure this in virtualmin without hacking - we need only 2 things: - Separate Nginx ip:port settings from Apache - Enable together Nginx & Apache on one virtualserver.
Submitted by yngens on Sun, 09/03/2017 - 23:11 Comment #8
Subscribing to track
Submitted by JamieCameron on Mon, 09/04/2017 - 12:17 Comment #9
Out of interest, which content do you use Nginx to serve, and which do you use Apache for? Or is Nginx doing pure caching only?
Submitted by Murz on Tue, 09/05/2017 - 02:54 Comment #10
I have 100+ websites on server, and only 5 of them give 80% of load for my server. So by default nginx works like global proxy for all sites to apache (redirects all queries from external-ip:80 to localhost:8080 apache port): https://devops.profitbricks.com/tutorials/configure-nginx-as-a-reverse-p...
But this 5 high-load sites I configure to work directly via nginx+php-fpm, without apache, for increase performance and decrease server load.
Even when nginx works as reverse proxy to apache - there are already good memory usage improvements, because apache process will give content to nginx and shut down with free-up memory, and nginx will give this content to user longer time with less memory usage.
Submitted by yngens on Wed, 09/20/2017 - 21:29 Comment #11
I am interested in implementation of similar request, but not limiting only to Nginx, but any other proxy like, for example, Pound or HAProxy, which could be used just for SSL termination (leaving all the web-server functionality to Apache intact). Discussing this on https://www.virtualmin.com/node/53661