[Plugin] nginx reverse proxy for apache2

Discussion in 'Plugins/Modules/Addons' started by MaddinXx, Aug 2, 2012.

  1. MaddinXx

    MaddinXx Member

    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/ispconfig-3-nginx-reverse-proxy

    Please see 2nd post for changelog and more details!
    Last edited: Aug 3, 2012
  2. MaddinXx

    MaddinXx Member


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

    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)
    Last edited: Aug 4, 2012
  3. MaddinXx

    MaddinXx Member

  4. Davide

    Davide Member

    Does this still work "as is" in Debian squeeze and ispconfig following instructions in https://github.com/Rackster/ispconfig3-nginx-reverse-proxy/wiki/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>
    <VirtualHost {tmpl_var name='ip_address'}:82>

    Thank you!
  5. MaddinXx

    MaddinXx Member

    Hi Davide

    The plugin still works as of version

    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"}>
  6. Davide

    Davide Member

    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!
  7. MaddinXx

    MaddinXx Member


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

    <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).
  8. MaddinXx

    MaddinXx Member

    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/ispconfig3-nginx-reverse-proxy/tree/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!
  9. WannaBeGeekster

    WannaBeGeekster New Member

    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.
  10. philgardner

    philgardner Member

    Is this project still live? The link to the wiki on Github doesn't work, so how are you meant to install the plugin?
  11. Tud

    Tud New Member

    Can someone do the simple instructions on how to install this add-on?
  12. Rolej

    Rolej New Member

    This plugin is compatibile with 3.1.x?
  13. OptimBro

    OptimBro Member

    Not working with letsencrypt.. :/

Share This Page