Welcome! Log In Create A New Profile

Advanced

Running other vhosts beside the catc-all default vhost

Nedim Hadzimahmutovic
June 17, 2010 10:50AM
I have a catchall default vhost, cat /etc/nginx/sites-available/default :



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;
}
}

It works perfectly but I want to have other vhosts on the same server
besides the default catchall one. If I add another server let's say in
/etc/nginx/sites-available/domain.com Nginx will ignore it. But if I add
that same server in /etc/nginx/sites-available/default before the catchall
server then it work perfectly.

The problem is that it is not really practical to keep all the
vhosts/servers in the same file.

Is there a way to make this work and not keep all the servers in
/etc/nginx/sites-available/default file?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

Running other vhosts beside the catc-all default vhost

Nedim Hadzimahmutovic June 17, 2010 10:50AM

Re: Running other vhosts beside the catc-all default vhost

Cliff Wells June 17, 2010 02:20PM

Re: Running other vhosts beside the catc-all default vhost

Nedim Hadzimahmutovic June 22, 2010 04:56AM

Re: Running other vhosts beside the catc-all default vhost

Nedim Hadzimahmutovic June 22, 2010 05:06AM

Re: Running other vhosts beside the catc-all default vhost

lockev3.0 January 25, 2012 10:55AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 226
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready