question regarding the Nginx Catch-All Host As Front End To Apache For ISPConfig3 tut

Discussion in 'HOWTO-Related Questions' started by Ovidiu, Oct 15, 2010.

  1. Ovidiu

    Ovidiu Active Member

    Just for references, I am talking about this tutorial: http://www.howtoforge.com/nginx-cat...end-to-apache-for-ispconfig-3-on-debian-lenny

    The issue is this: I have reached the limits of my current server config.
    I remember I didn't want to have any such installation of nginx or lighttpd a couple of years ago as traffic and logging were still an issue back than. It seems having nginx as a front-end web server works for traffic counting and logging now? Even if it doesn't I'd still love to implement this.

    Now onto my questions:

    Does anyone actually have this running according to the tutorial I linked to? Any other configuration changes I'd need if running the latest ispcfg3 and the latest Debian installation according to the perfect debian server setup from howtoforge?

    I don't fully understand this configuration file:

    Code:
    server {
        listen   80 default; 
            server_name  _;
            server_name_in_redirect  off;
        resolver  127.0.0.1;
    #### www. redirect    - all domains starting with www will be redirected to http://domain. ####
        if ($host ~* ^(www\.)(.+)) {
            set $rawdomain $2;
            rewrite ^/(.*)$  http://$rawdomain/$1 permanent;
        }
        access_log  /var/log/ispconfig/httpd/$host/access.log;
    location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|flv|html|htm|mp3)$ {
        root   /var/www/$host/web; 
        access_log off;
        expires 30d;
        }
    location / {
        root   /var/www/$host/web;
        index  index.html index.htm index.php;
            access_log      off;
            proxy_pass http://$host:82;
            proxy_set_header X-Real-IP  $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    }
    Does this configuration automatically redirect any request from www. to the non-www version? I can't have that, I have to let my clients decide that for themselves.
    Can I remove that by commenting the code like this:
    Code:
    #### www. redirect    - all domains starting with www will be redirected to http://domain. ####
    ###    if ($host ~* ^(www\.)(.+)) {
    ###        set $rawdomain $2;
    ###        rewrite ^/(.*)$  http://$rawdomain/$1 permanent;
    ###    }
    what exactly does this code do?
    To me it looks like it integrates into the existing logging system?
    Does it log errors too?
    Can someone add that code?
    Why does it say access_log off; is it disabled?

    anything else I need to know before heading out and implementing this tutorial? Any issues I should be aware off? Any incompatibilities involved?
    Can I continue updating ISPCFG3 as before without breaking anything?
     
  2. Ovidiu

    Ovidiu Active Member

    Anyone? Please, I#d be very glad even for partial answers - maybe you know hte answer to one of my questions at least?
     
  3. Ovidiu

    Ovidiu Active Member

    really nobody can add anything to my questions?
    I promise I won't bump it again!

    oh and is this tutorial compatible with this nginx version: nginx (0.7.67-3~bpo50+1 Debian Backports:lenny-backports) ?
     
    Last edited: Oct 18, 2010
  4. falko

    falko Super Moderator ISPConfig Developer

    I'd love to help, but I didn't try the tutorial. :(
     
  5. Ovidiu

    Ovidiu Active Member

    the problem is I don't have a testing server :-( that is the reason I was asking for people who have used/tried this plugin.

    Tried contacting the author of the howto but no response yet.
     
  6. Ovidiu

    Ovidiu Active Member

    @falko:

    is the part about ispcfg3 at least correct?
    I mean the part with the custom templates and can I continue updating ispcfg3 without breaking anything?

    I guess I will have ot give it a try one of these nights and would liek to at least know that if I get it to work I won't be sacrificing my future updates of ispcfg3...
     
  7. damir

    damir New Member

    Tenaka, install VM Player and install virtual machine that simulates your environment. Test it and than deploy it to your production server.

    Why try something that you are not familiar with on your live server and risk breaking the installation.
     
  8. falko

    falko Super Moderator ISPConfig Developer

    That's what I'd recommend as well.
     
  9. Ovidiu

    Ovidiu Active Member

    :) I know its good practice but I live in a country where the average internet connection is 384kbps. and I have 4 flatmates which gives each of us about 56k => modem speed I had 15 years ago when I lived in Europe :-(

    Will try and duplicate a test environment at home though but i.e. the upgrading I can't simulate I'd have to wait for a new ispcfg version to test...
     
    Last edited: Oct 22, 2010
  10. Ovidiu

    Ovidiu Active Member

    ran into some trouble, here is the error log:

    as far as I can see there are problems with the apache2 module server-status and subdirectories: /var/www/dany.zice.ro/web/robots.txt zice.ro is a wpmu installation where all subdomaisn are added dynamically. :-(

    Anyone has any ideas?
     
  11. falko

    falko Super Moderator ISPConfig Developer

    There seem to be problems with name resolution. What's in /etc/resolv.conf and /etc/hosts?
     
  12. Ovidiu

    Ovidiu Active Member

    and
    that looks ok to me.
    I thought its an issue with
    so here is my server-status config:

    is that ok that the deny is before the allow?
     
  13. falko

    falko Super Moderator ISPConfig Developer

    /etc/hosts and /etc/resolv.conf look ok to me as well as the server-status config.

    I think the problem is that localhost cannot be resolved for some reason (although it's in /etc/hosts). :confused:
     
  14. Ovidiu

    Ovidiu Active Member

    just had an idea:

    I could isntall nginx according to the howto on my live server but keep it running on port 82 and don't change anything within ispcfg or apache. so for testing purposes I can use it the other way around, proxyaing everything to apache on port 80 so I can test without any drawback to any visitors...

    maybe we can figure out what is goign wrong here?
    If that is an option please let me know and I'll put it all in palce and give you any log files you need to see...
     
  15. Ovidiu

    Ovidiu Active Member

    I might have another idea, I found this inside an error log:

    could this be the reason why the localhsot couldn't be resolved? Suhosin?
     
  16. falko

    falko Super Moderator ISPConfig Developer

    I don't think it has anything to do with it, but you could switch off Suhosin for testing purposes.
     
  17. Ovidiu

    Ovidiu Active Member

    would like to try that but can't find info on how to disable suhosin for a particular vhost. any help here?
     
  18. falko

    falko Super Moderator ISPConfig Developer

    I'd disable it globally for the server.
     
  19. Ovidiu

    Ovidiu Active Member

    got it working wit ha few little mods:

    changed:
    into
    and
    into
    does anyone see anything wrong with that? will post the question in the nginx forums too and report back here.
    currently nginx is running on port 82 and proxying back to apache2 on port 80 for testing purposes.
    once I got the confirmation from the nginx forums that that is ok I'll go live with it.
    Besides still got some open questions listed in my first post in this thread, i.e. about why the logging seems to be turned off in this config?
     
    Last edited: Nov 1, 2010
  20. Ovidiu

    Ovidiu Active Member

    some more progress:

    made some more progress with the help of some guys on IRC it seems these lines work:

    as 127.0.0.1 is enough, no need to use $host there as this is a reverse proxy, nginx and apache2 are on the same box.

    and another suggestion to solve the www vs non-www problem was something like this:

    but I can't put it togetehr alone. also would it not need an else statement to keep
    in case the non-www version was called?
     
    Last edited: Nov 3, 2010

Share This Page