Welcome! Log In Create A New Profile


Re: Virtualhosts and map

February 27, 2013 06:40AM
Hallo Jonathan,

I have some proplems with the english language. This is bad in the IT section.

My problem is, i can't find an complett example to do that for education. All I find is
the "old Way" with sites-availbled and sites-enabled, what I have done for years.

In January I chance nginx to the new version.

My files in the folder sites-availabled

My default file

# default server

server {
listen 80 default_server;
server_name _;
access_log logs/default/default.access.log;
error_log logs/default/default.error.log;

root /www/default;

location / {
root /www/default;
index index.html index.htm;

location /i/ {
alias /www/123/;

# redirect server error pages to the static page /40x.html

error_page 400 401 402 403 404 /40x.html;
location = /40x.html {
root /www/default/html;

# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /www/default/html;

If the IP (xxx.xxx.xxx.xxx) is type in the browser, it shows only domain example1.com.

After a few days I found the reason for this:

Change: now if the "include" directive with mask is used on Unix
systems, included files are sorted in alphabetical order.

My solution for this is to make a new big nginx.conf
In the part with the serverblocks the latest is the default one and all is OK.
This solution is OK for a few domains, but not for many domains.
I read that this can be done with map. But I can't find an example for this.

Now I am looking for examples how I can do that with map.

This from the nginx docu is not enough for me.

map $http_host $name {

default 0;

example.com 1;
*.example.com 1;
example.org 2;
*.example.org 2;
.example.net 3;
wap.* 4;

Subject Author Posted

Virtualhosts and map

Varix February 26, 2013 04:31AM

Re: Virtualhosts and map

Jonathan Matthews February 26, 2013 08:54AM

Re: Virtualhosts and map

Varix February 27, 2013 06:40AM

Re: Virtualhosts and map

Maxim Dounin February 27, 2013 08:04AM

Re: Virtualhosts and map

Varix February 27, 2013 10:42AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 100
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready