# Nginx domain work without be into sites-enabled

**URL:** <https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851>\
**Category:** NGINX\
**Created:** [August 3, 2015, 6:13am UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851 "2015-08-03T06:13:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [August 3, 2015, 6:13am UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/1 "2015-08-03T06:13:28Z")

</div>

Hello,

I have many subdomains which is created into /etc/nginx/sites-enabled.  
For  
example

1. [www.example.com](http://www.example.com)
2. [music.example.com](http://music.example.com)
3. [video.example.com](http://video.example.com)

are already enabled. and working fine. But I tried to remove  
[music.example.com](http://music.example.com) from public access. Then I did [music.example.com](http://music.example.com) from  
sites-enabled folder but I can access to [music.example.com](http://music.example.com). Site is  
still  
there.

How do I fix this ?

Posted at Nginx Forum:

> **[Nginx domain work without be into sites-enabled](https://forum.nginx.org/read.php?2,260717,260717#msg-260717)**
>
> Hello, I have many subdomains which is created into /etc/nginx/sites-enabled. For example 1. www.example.com 2. music.example.com 3. video.example.com are already enabled. and working fine. But I tried to remove music.example.com from publi

---

<div class="post-metadata">

**Author:** ![Eberx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58956e/32.png) [@Eberx](https://www.ruby-forum.com/u/Eberx)\
**Post date:** [August 3, 2015, 12:36pm UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/2 "2015-08-03T12:36:06Z")

</div>

On Mon, Aug 03, 2015 at 12:12:54AM -0400, Eberx wrote:

Hi there,

> I have many subdomains which is created into /etc/nginx/sites-enabled. For  
> example

Your nginx.conf presumably has “include /etc/nginx/sites-enabled/\*;”  
so that these files are read when nginx starts.

> 1. [www.example.com](http://www.example.com)
> 2. [music.example.com](http://music.example.com)
> 3. [video.example.com](http://video.example.com)
> 
> are already enabled. and working fine. But I tried to remove  
> [music.example.com](http://music.example.com) from public access. Then I did [music.example.com](http://music.example.com) from  
> sites-enabled folder but I can access to [music.example.com](http://music.example.com). Site is still  
> there.

Did you successfully restart or reload nginx after removing the file?

What response do you get for “curl -i [http://music.example.com/](http://music.example.com/)”?

What response do you want instead for “curl -i  
[http://music.example.com/](http://music.example.com/)”?

## f

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

---

<div class="post-metadata">

**Author:** ![Eberx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58956e/32.png) [@Eberx](https://www.ruby-forum.com/u/Eberx)\
**Post date:** [August 3, 2015, 5:15pm UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/3 "2015-08-03T17:15:58Z")

</div>

On Mon, Aug 03, 2015 at 07:41:15AM -0400, Eberx wrote:

> Francis D. Wrote:

Hi there,

> Set-Cookie: example=lda48dtiqiaqg46paqulh9ov56; path=/; [domain=.example.com](http://domain=.example.com)  
> Expires: Thu, 19 Nov 1981 08:52:00 GMT  
> Cache-Control: no-store, no-cache, must-revalidate, post-check=0,  
> pre-check=0  
> Pragma: no-cache
> 
> Below this header our website html displayed.

Is “our website html” from [music.example.com](http://music.example.com) or from [www.example.com](http://www.example.com) or  
from something else?

> > What response do you want instead for “curl -i  
> > [http://music.example.com/](http://music.example.com/)”?
> 
> I just want to go default vhost config.

What is your default vhost config?

If you want specific help, you will need to give specific details.

How nginx chooses which server{} block to use is described at

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

If you can create a config file where your nginx does not do what that  
page describes, then you will have found an interesting bug.

So: in your nginx.conf, plus any file that is "include"d in there,  
look at all of your server{} blocks, and in them, look at all of your  
“listen” and “server\_name” directives.

Then follow what that web page says, and identify which one server{}  
block  
nginx should use to handle your request for [http://music.example.com/](http://music.example.com/).

Is that the server{} block that you want nginx to use?

If not, make whatever changes are needed so that it is.

Good luck with it,

## f

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

---

<div class="post-metadata">

**Author:** ![Eberx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58956e/32.png) [@Eberx](https://www.ruby-forum.com/u/Eberx)\
**Post date:** [August 3, 2015, 1:41pm UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/4 "2015-08-03T13:41:32Z")

</div>

## Francis D. Wrote:

> On Mon, Aug 03, 2015 at 12:12:54AM -0400, Eberx wrote:
> 
> Hi there,
> 
> > I have many subdomains which is created into  
> > /etc/nginx/sites-enabled. For  
> > example
> 
> Your nginx.conf presumably has “include /etc/nginx/sites-enabled/\*;”  
> so that these files are read when nginx starts.

I added bottom of my nginx.conf file

```
    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;

```

> > there.
> 
> Did you successfully restart or reload nginx after removing the file?  
> Yes

> What response do you get for “curl -i [http://music.example.com/](http://music.example.com/)”?

I get response header

Server: nginx  
Date: Mon, 03 Aug 2015 11:39:04 GMT  
Content-Type: text/html; charset=utf-8  
Transfer-Encoding: chunked  
Connection: keep-alive  
Vary: Accept-Encoding  
Set-Cookie: example=lda48dtiqiaqg46paqulh9ov56; path=/;  
[domain=.example.com](http://domain=.example.com)  
Expires: Thu, 19 Nov 1981 08:52:00 GMT  
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,  
pre-check=0  
Pragma: no-cache

Below this header our website html displayed.

> What response do you want instead for “curl -i  
> [http://music.example.com/](http://music.example.com/)”?

I just want to go default vhost config.

> ## f
> 
> Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,260717,260724#msg-260724](http://forum.nginx.org/read.php?2,260717,260724#msg-260724)

---

<div class="post-metadata">

**Author:** ![Eberx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58956e/32.png) [@Eberx](https://www.ruby-forum.com/u/Eberx)\
**Post date:** [August 4, 2015, 6:04am UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/5 "2015-08-04T06:04:09Z")

</div>

Hello,

Thank you for advice.

It is my fault. I did not define any default\_server in my config.

Posted at Nginx Forum:

> **[Re: Nginx domain work without be into sites-enabled](https://forum.nginx.org/read.php?2,260717,260734#msg-260734)**
>
> Hello, I have many subdomains which is created into /etc/nginx/sites-enabled. For example 1. www.example.com 2. music.example.com 3. video.example.com are already enabled. and working fine. But I tried to remove music.example.com from publi

---

<div class="post-metadata">

**Author:** ![Eberx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/58956e/32.png) [@Eberx](https://www.ruby-forum.com/u/Eberx)\
**Post date:** [August 5, 2015, 9:20am UTC](https://www.ruby-forum.com/t/nginx-domain-work-without-be-into-sites-enabled/242851/6 "2015-08-05T09:20:30Z")

</div>

On Tue, Aug 04, 2015 at 12:03:28AM -0400, Eberx wrote:

Hi there,

> Thank you for advice.
> 
> It is my fault. I did not define any default\_server in my config.

Good that you found a solution, and thanks for letting the list know  
what the fix is.

Cheers,

## f

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