Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Plugins/Modules/Addons

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd August 2012, 20:10
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default [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!
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter

Last edited by MaddinXx; 3rd August 2012 at 02:16.
Reply With Quote
The Following 3 Users Say Thank You to MaddinXx For This Useful Post:
falko (3rd August 2012), pititis (6th August 2012), till (3rd August 2012)
Sponsored Links
  #2  
Old 2nd August 2012, 20:14
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default

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)
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter

Last edited by MaddinXx; 4th August 2012 at 17:29.
Reply With Quote
  #3  
Old 6th August 2012, 00:58
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default 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
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
  #4  
Old 28th October 2012, 17:43
Davide Davide is offline
Senior Member
 
Join Date: Jul 2006
Posts: 123
Thanks: 16
Thanked 9 Times in 8 Posts
Default

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!
Reply With Quote
The Following User Says Thank You to Davide For This Useful Post:
robertoshulze2257 (7th August 2014)
  #5  
Old 28th October 2012, 20:39
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default

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"}>
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
The Following User Says Thank You to MaddinXx For This Useful Post:
robertoshulze2257 (7th August 2014)
  #6  
Old 30th October 2012, 21:33
Davide Davide is offline
Senior Member
 
Join Date: Jul 2006
Posts: 123
Thanks: 16
Thanked 9 Times in 8 Posts
Default

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!
Reply With Quote
  #7  
Old 30th October 2012, 22:13
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default

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).
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
  #8  
Old 26th October 2013, 23:10
MaddinXx MaddinXx is offline
Senior Member
 
Join Date: Jul 2011
Location: Switzerland
Posts: 197
Thanks: 25
Thanked 62 Times in 46 Posts
Default

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!
__________________
Rackster Internet Services's presences:
Official | Open Source | Github | Facebook | Twitter
Reply With Quote
The Following User Says Thank You to MaddinXx For This Useful Post:
robertoshulze2257 (7th August 2014)
  #9  
Old 4th August 2014, 17:24
WannaBeGeekster WannaBeGeekster is offline
Junior Member
 
Join Date: Aug 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default 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.
Reply With Quote
Reply

Bookmarks

Tags
nginx, plugin, proxy

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NGINX reverse proxy to apache - Settings? agriz Server Operation 2 23rd January 2012 11:12
Transparent reverse squid proxy d31373 Installation/Configuration 5 22nd November 2009 20:44
Squid Reverse Proxy EricTRA HOWTO-Related Questions 0 28th July 2009 08:20
Mod_Perl Configuration Issue szise Installation/Configuration 4 28th November 2008 12:41
Apache reverse proxy with mod_proxy and 302 redirection Cloud Server Operation 6 1st March 2008 14:55


All times are GMT +2. The time now is 12:41.


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