Comments on Nginx Catch-All Host As Front End To Apache For ISPConfig 3 On Debian Lenny

Nginx Catch-All Host As Front End To Apache For ISPConfig 3 On Debian Lenny Apache has always been the web server of choice for me. It is a real beast when it comes to resources usage specially in a resource limited environment such as a VPS. I started playing with Nginx a lightweight, high performance web server. My area of interest was running Nginx as a reverse proxy and making it work in a Apache/ISPConfig 3 environment.

13 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Conor Duffy

Any chance of a similar guide for Lighttpd?

By: Aurelian

Can it be simillar for ISPCONFIG 2?

 

Thanx

By: icmono
By:

With a few minor changes found in the forums, (http://www.howtoforge.org/forums/showthread.php?t=49443&highlight=nginx) I have nginx running in front of my ispconfig3 control panel and a couple virtual hosts.

ab -c 100 -n 10000 http://hostname/index.php results are amazing.

I am able to compare the original sites to the same sites behind the nginx proxy. The old sites were barely able to run 100 requests per second, the new is in excess of 4-5,000 requests per second.

Nice work, Nedim.

Regards,

Rob

By: Iain

Sorry, but where do you place: ab -c 100 -n 10000?? 

I have it working aswell now, but would love it if you would share where you would place that line of code. 

 Didn't find it on the forum you linked it in your reply

 Thanks

By:

 when I try to download files such as zip
,rar,avi, 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)$ {

Server completely crashes (freezes) Only hard restart helps
I can not understand the reason????????????????? HELP

By: Anonymous

server {
listen 80 default;
server_name _;
server_name_in_redirect off;
resolver 127.0.0.1;
error_page 404 = @fallback;
#--------------??? 404 ?????? ?? ????????? ?????-------------------------------
location @fallback {
proxy_pass http://$host:82;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
#--------------??????????? ??????? ?????? ?? ??????-----------------------------
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|mp3)$ {
root /var/www/$host/web;
access_log off;
expires 30d;
}
#--------------HTML ????? ???????? ???????? ????? ????? ???? ????????????-------
location ~* ^.+\.(htm|html)$ {
root /var/www/$host/web;
# try_files $uri /index.php ;
access_log off;
expires 30d;
}
# -------------???????? ???????? -----------------------------------------------
location / {
root /var/www/$host/web;
index index.php index.html index.htm;
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;
}
#-------------- ????????? ??? phpmyadmin----------------------------------------
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
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;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
#------------- WEBMAIL----------------------------------------------------------
location /webmail {
root /var/www/apps;
index index.php index.html index.htm;
proxy_pass http://$host:82;   
https://open-source.rackster.ch/project/ispconfig3-nginx-reverse-proxy-plugin

By:

For those who can use IP based vhosts use following setup

listen   YOU-IP-ADDRESS:80 default;

This was you will not have to use a resolver - I had problems with nginx not serving sites if DNS server goes down.

By: Phgrey

To make it realy works I've got to change the row  proxy_pass http://$host:82;

with this one

 proxy_pass http://127.0.0.1:82/;

By: iain

There is one flaw in this whole idea, and that is when things like roundcube squirrelmail or even phpmyadmin are hosted outside of /var/www/*  things like css etc that are managed by Nginx result in a 404 error.

 Thus resulting improper function of these services, please complete this tutorial by helping me find a fix for this problem.

  

By:

I think creating a symlink in /var/www/ does the trick, for example :

ln -s /usr/share/phpmyadmin /var/www/phpmyadmin.example.tld

The real problem is, this would have to be done manually also for any ServerAlias in any Apache vhost.

That makes this configuration hardly usable if you have lots of Apache vhosts having lots of ServerAliases...

By: RATEFIARISON Aina Manoa

Need to remove this line from /etc/nginx/conf.d/default.conf :

rewrite ^/(.*)$ http://$rawdomain/$1 permanent;

By: realware

I followed the guide, but beside one main site, all vhosts stopped working: phpmyadmin, roundcube and all apps too.

Every site was refusing connections

Anyone able to point out more recent  guide ?