virtualmin + nginx

45 posts / 0 new
Last post
#1 Wed, 10/19/2011 - 08:34
jonigood

virtualmin + nginx

Hello I'am sorry for my bad english

I am a user of Virtualmin for a few years .... and I had a problem since I installed nginx with Virtualmin.

I use nginx as proxy for the static content of all my Website hosted on Virtualmin, so I was changed the listening port of apache2 and vhost in 8081, nginx receive on port 80 for static content and the rest is on port 8081 for apache2

everything works fine except a detail, since this change I can't manage the website option from the Virtualmin interface, for example when I click on "Website Options" in the "Server Configuration" I receive this message:

Website options cannot be edited, as no Apache virtual host for my-website.com port 80 was found!

in addition,i can't see the apache log file (error_log and acces_log) from Virtualmin, the tab has disappeared since this change,

thank you in advance for your help and good luck to Virtualmin ,wich has become an important thing for all my hosting servers, nice work thank you to all the team

jonigood.

Wed, 10/19/2011 - 08:49
andreychek

Howdy,

Yeah, Virtualmin expects that Apache is the only webserver on your system -- and thinks something is broken when it's not running on port 80.

There isn't really a supported method of using a proxy on port 80, and Apache on an alternate port.

That said -- I'll talk to Jamie to see about adding support for that into Virtualmin.

-Eric

Wed, 10/19/2011 - 18:25
jonigood

thank you for your answer

I am looking in webmin configuration file and I find a partially solution of my problem, I post here the solution that can help someone else :

In /etc/webmin/virtual-server/domains

there is all domains created by Virtualmin numbered like this:

131723426823795 13172463203357 13178722157623 ....

now you choose once above wich correspond to your domain :

vi /etc/webmin/domains/131723426823795

you find "web_port=80" you chnage for "web_port=8081" you save and close file

you restart webmin /etc/init.d/webmin restart

after this you can see and modify all option siteweb in a virtualmin interface :)

there is only one problem,i still looking for a solution to bring up the section of log apache2, I'm still searching a solution to resolve this problem, if you have an idea please help :)

thank you for your respond

Thu, 10/20/2011 - 06:29
jonigood

to make this automatic action by Virtualmin for creatation of new virtual server using Virtualmin initeface you edit :

vi /etc/webmin/virtual-server/config

you change "web_port=80" for "web_port=8081" you save and close file, restart webmin ...

Now it's automatic, Virtualmin can find the configuration apache2 of your virtual servers even if it not on port 80.

;-)

Thu, 10/20/2011 - 12:32
jonigood

Problem solved for log apache2

just (after changing the /etc/webmin/virtual-server/config file as explained above) re create their virtual server with Virtualmin, now you have all disponnible option even if your server apache2 is not on port 80

cordially jonigood

Thu, 10/20/2011 - 12:40
jonigood

hi Eric

I decided to create a module for Virtualmin to manage nginx and add a virtual host without having to manually edit each time the config file of apache, nginx and webmin...

But i not find any link to explain the creation of Virtualmin modules, you have a link to give me ?

thank you

Thu, 10/20/2011 - 12:47
andreychek

Howdy,

Well, note that Jamie is currently working on Nginx support for Virtualmin -- it should be ready within a few weeks.

That said, if you're still interested in giving that a shot, there's information on creating modules here:

http://www.virtualmin.com/documentation/developer/plugins

http://doxfer.webmin.com/Webmin/TheWebminAPI

Thu, 10/20/2011 - 22:40
jonigood

hi

if Jamie is working on Nginx support i wait it will be better that my module.... lol

thank you for all

Fri, 11/18/2011 - 19:07
kfawcett

Awesome! Any update on when nginx support will be ready?

Fri, 11/18/2011 - 22:44
andreychek

Nginx support is coming along. We don't have any specific dates, but keep an eye out in the News forum for updates, there should be something there soon. He may even post a note there in the News forum looking for beta testers if you're interested in that.

-Eric

Fri, 11/18/2011 - 22:46
kfawcett

Hey Eric,

I'd be happy to test.

Thanks Keith

Mon, 11/28/2011 - 09:55
Mon, 11/28/2011 - 10:03
andreychek

You guys are certainly on the ball keeping an eye on that documentation! :-)

Nginx support is still coming along, it should be here soon!

Jamie just added those docs yesterday, and is still finishing them up. But to my knowledge, they'll soon be doing a beta test, and an announcement about that will be in the News forum.

-Eric

Mon, 11/28/2011 - 10:29 (Reply to #13)
saoullabit

I was praying that Virtualmin will support that web server so I'm always on the lookout ! (sorry to be late, but I'm in France that can explain the delay between the post and its discovery ;-)

Mon, 11/28/2011 - 10:09
kfawcett

Hopefully the documentation will also focus on moving from an Apache setup to Nginx. ;)

Mon, 11/28/2011 - 11:04
andreychek

Hopefully the documentation will also focus on moving from an Apache setup to Nginx

Out of the box, there's going to be no quick and simple way to perform a migration. The Nginx setup is going to be for folks with new installations. There isn't a simple way to migrate the Apache config over to Nginx, unfortunately.

Will there be in the future? Maybe! But, the first goal is to make it so that Virtualmin supports Nginx. A goal for the future is to handle migrations from Apache to Nginx.

-Eric

Mon, 11/28/2011 - 12:35
kfawcett

Will it be possible to setup a new server for Nginx and then import/restore a backup of each virtual server to it?

Mon, 11/28/2011 - 12:37 (Reply to #17)
saoullabit

That would be awesome !

Mon, 11/28/2011 - 13:30
andreychek

Will it be possible to setup a new server for Nginx and then import/restore a backup of each virtual server to it?

Unfortunately not!

Not initially, anyhow.

Getting Virtualmin to support Nginx at all was crazy hard, and Jamie is putting the finishing touches on that.

Coming up with a way to convert an Apache config to an Nginx config is also tricky -- and we didn't want that to hold up the release of Nginx.

So, Nginx support will be released here soon -- it'll only work on new installations with new Virtual Servers, there isn't any sort of conversion from existing Virtual Servers.

There may be a way to do that in the future, but we don't know any details there yet; we're currently just concerned with getting Nginx support out the door :-)

Now, that's not to say that it can't be done with some manual work.

If you were to first create a Virtual Server on your new Nginx server -- I believe you could then perform a restore of a backup file that once ran on Apache, and simply uncheck the option to restore the "Apache webserver configuration", as well as other incompatible features.

Once you've unchecked all the incompatible features, you should then be able to restore that backup onto the newly created Virtual Server on your system running Nginx.

-Eric

Tue, 11/29/2011 - 14:28
unsalkorkmaz

can you release it for virtualmin GPL too? :-/ btw i read that Documentation but i would like to use nginx as frond-end proxy server not main server for php handling.. will it support that type?

Tue, 11/29/2011 - 15:20
andreychek

The Nginx support has been built so that it would be your only web server, in place of Apache. It'll work great for those on VPS's, and other low-memory systems, as well as for folks on dedicated servers who feel it's speedier.

So while you could manually configure it to work as a front-end proxy, Virtualmin won't assist with that setup.

Might there be a feature to use Nginx as a proxy later? Sure, maybe! But, we're working to get this first version out the door, and then we can discuss other features such as that.

Will it work on Virtualmin GPL? That I'm not sure of yet. It was a costly feature to create, and it's possible that it could be given to the Pro users for a bit, and then after a few months put into Virtualmin GPL. But we also know that users of both Pro and GPL would benefit from it, so a final decision hasn't been made there yet :-)

-Eric

Tue, 11/29/2011 - 18:10
helpmin

I would also like to see this in the GPL version. But probably the target audience are users with a lot of visitors on their site. They probably make a lot of money with their high volume sites :-)

Thu, 12/01/2011 - 09:01
cybuch

@up The rest of audience are users who's working with VPS or small servers and need to save their resources ; ), but I understand that you expects to get paid for your job, hopes that it will be aviable for VM GPL someday.

Thu, 12/01/2011 - 12:59
kfawcett

Virtualmin Pro is a great investment and not that expensive really. I don't see how anyone running more than a couple of sites could not justify the small annual fee. For the amount of support we get from Eric, Joe, Jamie, and the rest of the team, and the continual improvement that is put into the product, I'm very happy to purchase Virtualmin Pro.

Thanks Virtualmin you make my life so much easier! Can't wait to test out nginx.

Mon, 12/12/2011 - 08:10
bvansomeren

First off, congratulations on including Nginx in the latest version of Virtualmin, I'm sure lots of blood, sweat and tears went into this. I've been looking forward to this for quite some time and have started testing this new feature.

I have just a single question really. What is the best way to get PHP-FPM supported within Virtualmin?

Running on CentOS 6 I notice you use the old FastCGI without a manager, which is very easy to break (Just hit it with some traffic and the process dies) Also, it means that every site will gobble up at least 64 mb (my settings) even when there is no traffic. With Apache you can have these FastCGI processes reclaimed and I believe php-fpm supports the same.

Tue, 12/13/2011 - 09:47
kfawcett

bvansomeren,

I believe they are still working on nginx integration. I too tried to follow the direction's given, but when I tried to setup a new server the nginx configuration failed. Hopefully they'll let us know when it's ready for beta testing.

Tue, 12/13/2011 - 10:07
bvansomeren

Sure it probably needs some work, but I've been able to get some sites running on it fine with 3.89 I did add the rewrite rules manually to the configuration because I was unsure to to use the rewrite config option in the GUI (the try files command is very simple to add)

My biggest issue is the ancient fastcgi spawn that is being used over php-fpm. This is not a flaw in Virtualmin though, I believe both CentOS (5 and 6) and Debian don't come with php-fpm out of the box.

Wed, 12/14/2011 - 15:50 (Reply to #27)
kfawcett

bavnsomeren,

How did you get it to work? Were you doing a new install on CentOS 6? Can you tell me the steps you followed?

I followed the steps given in the documentation, but when I try to enable Nginx in the plugin and features page it fails at the nginx configuration. Then when I try to create a virtual server I get the same failed nginx failed configuration.

I had to also manually input the nginx full command path in order to try to enable nginx on the plugin and features page.

Wed, 12/14/2011 - 17:26 (Reply to #28)
andreychek

There does appear to be a bug where Virtualmin isn't detecting Nginx by default; to correct that, you can go into System Settings -> Features and Plugins -> Nginx website -> Configure, and set "Full path to Nginx command" to "/usr/sbin/nginx". By default, that appears to be blank.

There's a bug report regarding that issue filed here:

https://www.virtualmin.com/node/20451

Sat, 12/17/2011 - 16:54 (Reply to #29)
bvansomeren

Hi,

Yes, I had to do the same. Also I moved nginx to port 8080 because I place Varnish in front of the webserver. Once the config is setup, everything works like a charm.

Well, except for the PHP problem I mentioned. Let's hope this is something that is in the pipeline.

Tue, 01/10/2012 - 19:21
jser

Hi, this new module to support alternate webservers is great.

I haven't seen any code or specs (only read here: http://www.virtualmin.com/documentation/web/nginx) so I'm interested in knowing how Nginx is configured within the server environment. Some setups have Nginx as a static file server proxy passing dynamic content requests to Apache running on a different port.

I'm interested in whether Nginx will run standalone without Apache as a backend. I currently have the following setup on a server in production and it's fairly screaming along.

  • Nginx serving static content
  • passing PHP requests off to PHP-FPM
  • PHP-FPM backend is running as a Unix socket, not on a TCP port
  • APC or other opcode caching system in use.

PHP FastCGI Process Manager (http://php-fpm.org/) allows you to run PHP as a process per user. PHP can be restarted or the separate per user processes killed if required.

This is currently the fastest way to serve PHP content on the planet and the load profile for Nginx is shockingly low compared to Apache. I'm still astounded at how fast this setup runs as compared to Apache + PHP using Fcgi.

I'd be interested to know if Nginx + PHP-FPM could be run that way using this new module. Am happy to help out with testing or sample configurations if required.

If Virtualmin could run Nginx + PHP-FPM like this it would be a fair step ahead of any other hosting control panel, open or closed source.

Thanks again

James

Wed, 01/11/2012 - 14:08 (Reply to #31)
andreychek

Howdy,

Virtualmin sets up Nginx so that it passes off PHP requests to FCGID. It doesn't need Apache to work though, Nginx is standalone.

Jamie is currently looking into PHP-FPM support, though that doesn't exist as of yet.

You could certainly setup PHP's APC module to work alongside that as well.

Does that answer your question?

-Eric

Sun, 01/22/2012 - 21:08 (Reply to #32)
jser

Hi Eric

That's great and just the info I was after. A lot of Nginx howtos set it up to pass PHP requests through to Apache/FCGID running on another port. Having it standalone is the faster option.

I have a server setup running Nginx + PHP-FPM and it's blisteringly fast. Happy to help with any config for this setup as I've "been there, done that".

Cheers James

Mon, 01/23/2012 - 05:50
saoullabit

Hi jameser,

I made a Nginx conf using nginx as a proxy serving static files and forwarding php stuffs to Apache with mod_php, that works really great. I would be happy to share that and have some informations on how you did the Nginx+PHP-FPM and make Nginx + apache+fcgi work with the user as owner of the virtual host !

andreychek, can we add some posts on the online the documentation ? (reviewed of course :) )

Regards, Marc.

Mon, 01/23/2012 - 08:05 (Reply to #34)
andreychek

Howdy,

Yup, feel free to share configs (and links to configs)!

And if some cases, we may ask if we can borrow them for our documentation section :-)

Tue, 02/21/2012 - 20:26
jser

Hi

Aps for the silence, I've been beavering away on some configs.. what's the best way to share them ? I can email them or post them to a blog. Obv in public, anyone can use them but you know I want virtualmin to get the jump ;)

I'd be interested in some feedback on the configs, I'm sure there will be some questions.

Thanks James

Wed, 02/22/2012 - 00:00 (Reply to #36)
andreychek

Howdy,

Well, it'd be great if other Virtualmin folks were able to take advantage of them -- is there any chance you could start a new forum thread, and either post your configs, or links to your blog posts containing the configs?

And then, folks could offer their feedback in that new forum thread you start.

Thanks!

-Eric

Mon, 02/27/2012 - 16:48
helpmin

Did anybody compare the new Apache 2.4 version with Nginx. It is supposedly more efficient and faster than Ngix (but still has much bigger feature set than Nginx)? I would be interested in the results.

Wed, 02/29/2012 - 06:04
ducce111

Hi I found this comparison not a perfect one but seem apache is still ram hungry.
http://mondotech.blogspot.com/2012/02/apache-24-vs-nginx-benchmark-showd...

Sun, 04/08/2012 - 11:34
360111697
Wed, 04/25/2012 - 18:10
budgierless

any news on a custom nginx (frontend) with apache (backend) module?

Thu, 04/26/2012 - 03:33
saoullabit

I bought 2 licences now, and I "pray" for the custom nginx (frontend) with apache (backend) module ! Even if I made it work. I don't how to post the procedure ... but I think I can provide it.

Thu, 04/26/2012 - 04:38
budgierless

Well i saw some info about virtualmin modules, i will see if i can find it, also maybe i we can talk about a little development project for this using google-code?

Fri, 05/04/2012 - 16:44
budgierless

anyone?

Fri, 02/13/2015 - 18:46
unsalkorkmaz

Bump.

http://devkardia.com/easyblog/virtualmin-apache-and-nginx-reverse-proxy.... Cant you include that code for frontend nginx support?