# Getting this error: Starting nginx: : conflicting server name domain2.com

**URL:** <https://www.ruby-forum.com/t/getting-this-error-starting-nginx-conflicting-server-name-domain2-com/184946>\
**Category:** NGINX\
**Created:** [March 10, 2010, 8:38pm UTC](https://www.ruby-forum.com/t/getting-this-error-starting-nginx-conflicting-server-name-domain2-com/184946 "2010-03-10T20:38:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![d3l0n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df705f/32.png) [@d3l0n](https://www.ruby-forum.com/u/d3l0n)\
**Post date:** [March 10, 2010, 8:38pm UTC](https://www.ruby-forum.com/t/getting-this-error-starting-nginx-conflicting-server-name-domain2-com/184946/1 "2010-03-10T20:38:26Z")

</div>

I have two domains [domain1.com](http://domain1.com) and [domain2.com](http://domain2.com). The settings I have for  
[domain1.com](http://domain1.com) are:

server {

```
        listen 80;
        server_name www.domain1.com;
        rewrite ^/(.*) http://domain1.com/$1 permanent;

       }

```

server {

```
        listen 80;
        server_name domain1.com;

        access_log 

```

/home/test/public\_html/domain1.com/log/access.log;  
error\_log /home/test/public\_html/domain1.com/log/error.log;

```
        location / {

                    root 

```

/home/test/public\_html/domain1.com/public/;  
index index.html;

```
                    }

        }

```

And the settings I have for [domain2.com](http://domain2.com) are:

server {

```
        listen 80;
        server_name domain2.com;
        rewrite ^/(.*) http://www.domain2.com/$1 permanent;

       }

```

server {

```
        listen 80;
        server_name domain2.com;

        access_log 

```

/home/test/public\_html/domain2.com/log/access.log;  
error\_log /home/test/public\_html/domain2.com/log/error.log;

```
        location / {

                    root 

```

/home/test/public\_html/domain2.com/public/;  
index index.html;

```
                    }

        }

```

The main difference is in the re-write rule. In the current state when I  
start nginx I get the following error:

Starting nginx: : conflicting server name “[domain2.com](http://domain2.com)” on 0.0.0.0:80,  
ignored  
nginx.

And accessing [domain2.com](http://domain2.com) will lead to nginx welcome page.

If I change the re-write rule of [domain2.com](http://domain2.com) to match [domain1.com](http://domain1.com) then  
the warning message disappears and I can access [domain2.com](http://domain2.com) page just  
fine.

Any help please?

Thanks

Posted at Nginx Forum:

> **[Getting this error: Starting nginx: \[warn\]: conflicting server name domain2.com](https://forum.nginx.org/read.php?2,62419,62419#msg-62419)**
>
> I have two domains domain1.com and domain2.com. The settings I have for domain1.com are: \[code\] server { listen 80; server\_name www.domain1.com; rewrite ^/(.\*) http://domain1.com/$1 permanent;

---

<div class="post-metadata">

**Author:** ![d3l0n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/df705f/32.png) [@d3l0n](https://www.ruby-forum.com/u/d3l0n)\
**Post date:** [March 10, 2010, 9:01pm UTC](https://www.ruby-forum.com/t/getting-this-error-starting-nginx-conflicting-server-name-domain2-com/184946/2 "2010-03-10T21:01:16Z")

</div>

> ```
> listen 80;
> server_name domain2.com;
> 
> ```

- 

```
       server_name domain2.com;

```

- 

```
       server_name www.domain2.com;

```

Best regards,  
Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>
