HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Plugins/Modules/Addons (http://www.howtoforge.com/forums/forumdisplay.php?f=34)
-   -   [Plugin] nginx reverse proxy for apache2 (http://www.howtoforge.com/forums/showthread.php?t=58164)

MaddinXx 2nd August 2012 21:10

[Plugin] nginx reverse proxy for apache2
 
Hi HowToForge'ers

I have now been playing a longer time with nginx and the try, putting it in front of apache2 as a reverse proxy.

In general it is not that hard, but to get it play nicely together with ISPConfig isn't so easy.

I already had two "working" variants. One of them was with a universal default nginx server, doing a DNS lookup and choosing the proxy_pass server based on it - well, I just didn't like this and it had some problems.

Secondly, I tried with nginx "vhosts" per site etc. like ISPConfig does it for apache2, but I had problems with folder protection etc. since I was trying to serve static files directly through nginx.

What I want to do now, is presenting you my last try. It's not finished yet, but it already has some working code.

I also tried to create it on a "modular" base with PHP classes (I'm not a programmer anyway) so these parts can be reused within other plugins.

So for example we have the "vhost" class which does nothing other than handle everything related with vhost files.

There is something similar with the cert class, handling ssl...

Yep, it might be the best if you would just take a look. Contributions are very welcome!

You can follow/fork etc. the repository over at GitHub: https://github.com/Rackster/ispconfi...-reverse-proxy

Note
Please see 2nd post for changelog and more details!

MaddinXx 2nd August 2012 21:14

Changelog

20120803
The plugin is now nearly stable, everything expect Redirects is working

20120802
Presentation and initial repository

What's working
  • Site Insert
  • Site Update
  • Site Delete
  • SEO Redirect
  • Auto-Subdomain
  • Subdomains
  • Aliasdomains
  • SSL

What's not working
  • Redirects (everywhere: site, alias, subdomain) apache2 only atm (doesn't change the servers behavior in any way)

MaddinXx 6th August 2012 01:58

edit functions seems to close after a while
 
20120806
Renamed GitHub repo, new location at: https://github.com/Rackster/ispconfi...-reverse-proxy
added vhost backup

Davide 28th October 2012 18:43

Does this still work "as is" in Debian squeeze and ispconfig 3.0.4.6 following instructions in https://github.com/Rackster/ispconfi.../Installation?

I can't find the following:

so we can modify the copy (which is much more safer):

nano /usr/local/ispconfig/server/conf-custom/vhost.conf.master

and replace the correct parts (you'll find them) with:

<tmpl_if name='ssl_enabled'>
<VirtualHost {tmpl_var name='ip_address'}:445>
<tmpl_else>
<VirtualHost {tmpl_var name='ip_address'}:82>
</tmpl_if>

Thank you!

MaddinXx 28th October 2012 21:39

Hi Davide

The plugin still works as of version 3.0.4.6.

the file itself (/usr/local/ispconfig/server/conf-custom/vhost.conf.master) gets copied a step above, e.g. you copy the file from ../conf to conf-custom.

Afterwards the part you have to replace with the one provided looks something like:

<VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name="port"}>

Davide 30th October 2012 22:33

I've been searching for two "port" to replace, evidently with no success.

So have I to replace that only one line with the code you provides?

Thank you!

MaddinXx 30th October 2012 23:13

Hi

Yes, the code you have to replace is on line 9:

Code:

<VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}>
It's only one because ISPConfig loops two times through the template filing the port variable with 2 values (just that you understand how it works normally). The replacement (as stated in the install guide on Github) kind of "destroys" this loop for thiis specific variable (port).

MaddinXx 27th October 2013 00:10

Just to let you all know:

I've created a new Git branch which uses the upstream nginx_plugin as a base. It can be found here: https://github.com/Rackster/ispconfi...ree/feature/v2

Benefits are, that it support all ISPConfig settings like protected folders, rewrites etc. and serves static files directly.

One thing to keep in mind: .htaccess files are ignored for static files inside those folders (and in general, the http auth needs testing).

If someone is going to use this version, please leave a feedback. Thanks!

WannaBeGeekster 4th August 2014 18:24

Any luck
 
Anyone else use this plugin and have any luck with it? We definitely want to use it but I am on CentOS and can't seem to get it to work yet.

It doesn't seem to be creating the configuration files.


All times are GMT +2. The time now is 11:01.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.