# Set default nginx-conf in sites-enabled?

**URL:** <https://www.ruby-forum.com/t/set-default-nginx-conf-in-sites-enabled/236060>\
**Category:** NGINX\
**Created:** [August 2, 2013, 2:39pm UTC](https://www.ruby-forum.com/t/set-default-nginx-conf-in-sites-enabled/236060 "2013-08-02T14:39:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![addis\_a](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c4cdca/32.png) [@addis\_a](https://www.ruby-forum.com/u/addis_a)\
**Post date:** [August 2, 2013, 2:39pm UTC](https://www.ruby-forum.com/t/set-default-nginx-conf-in-sites-enabled/236060/1 "2013-08-02T14:39:03Z")

</div>

I’ve several config-files in sites-enabled, all working fine. However,  
if a  
domain ([foobar2.com](http://foobar2.com)) not is mentioned in a config, NGINX takes the  
conf-file  
of [foobar1.com](http://foobar1.com). How can i overrule this and make some sort of catch-all?  
With the line in the default-config i get an error 500:

server {  
listen 80 default\_server;  
server\_name \_; # This is just an invalid value which will never  
trigger  
on a real hostname.

```
 server_name_in_redirect off;
 root /home/user/www/park;

        location / {
            # This is cool because no php is touched for static 

```

content  
try\_files $uri $uri/ /index.html;  
}

}

Help … :-?

Posted at Nginx Forum:

> **[Set default nginx-conf in sites-enabled?](https://forum.nginx.org/read.php?2,241479,241479#msg-241479)**
>
> I've several config-files in sites-enabled, all working fine. However, if a domain (foobar2.com) not is mentioned in a config, NGINX takes the conf-file of foobar1.com. How can i overrule this and make some sort of catch-all? With the line in the...

---

<div class="post-metadata">

**Author:** ![lennart](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b9bd4f/32.png) [@lennart](https://www.ruby-forum.com/u/lennart)\
**Post date:** [August 2, 2013, 2:55pm UTC](https://www.ruby-forum.com/t/set-default-nginx-conf-in-sites-enabled/236060/2 "2013-08-02T14:55:59Z")

</div>

On Fri, Aug 02, 2013 at 08:38:28AM -0400, lennart wrote:

Hi there,

> I’ve several config-files in sites-enabled, all working fine. However, if a  
> domain ([foobar2.com](http://foobar2.com)) not is mentioned in a config, NGINX takes the conf-file  
> of [foobar1.com](http://foobar1.com). How can i overrule this and make some sort of catch-all?

> **[How nginx processes a request](http://nginx.org/en/docs/http/request_processing.html)**

If a server name is not mentioned in any relevant server block, nginx  
chooses the default server for this ip:port.

Make your “catch-all” be the default for this “listen” ip:port  
combination.

> With the line in the default-config i get an error 500:

What does the error log say?

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
