# Hosting multiple domains

**URL:** <https://www.ruby-forum.com/t/hosting-multiple-domains/235356>\
**Category:** NGINX\
**Created:** [June 16, 2013, 4:40am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356 "2013-06-16T04:40:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [June 16, 2013, 4:40am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356/1 "2013-06-16T04:40:31Z")

</div>

I have a server that I set up to run several domains from and it has  
worked great and without issue for about 6 months.

I have another server that I had set up and was only running one  
domain from it and I just added a second domain. For some reason, this  
second server does not want to serve two domains, and I can find no  
substantial differences in the configuration files (nginx.conf and  
sites-available files).

On both servers I put a symlink in the sites-enabled folder to the  
corresponding sites-available file.

On the second, problematic server, when creating a symlink to the  
second site and restarting nginx, testing the second domain only  
brings up the first domain. Rebooting the server disables both domains  
and the server appears unresponsive, except that I can SSH into it.  
Then removing the symlink to the second domain and restarting nginx  
returns the server to serving the one domain as it has been doing.

The first server is running nginx 1.5.0 and the second server is  
running nginx 1.4.1.

What should I be looking at to resolve this issue?

---

<div class="post-metadata">

**Author:** ![Paul\_NSPace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Paul\_NSPace](https://www.ruby-forum.com/u/Paul_NSPace)\
**Post date:** [June 16, 2013, 5:01am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356/2 "2013-06-16T05:01:33Z")

</div>

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![Paul\_NSPace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Paul\_NSPace](https://www.ruby-forum.com/u/Paul_NSPace)\
**Post date:** [June 16, 2013, 5:05am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356/3 "2013-06-16T05:05:04Z")

</div>

Hello!

On Sat, 2013-06-15 at 19:39 -0700, Paul N. Pace wrote:

> corresponding sites-available file.
> 
> What should I be looking at to resolve this issue?

Without seeing the config files/error logs, it’s difficult to find the  
problem. However, I can confirm that both name and IP address based  
hosting works perfectly.

nginx -t

may well help identify incorrect config files.

Note there is some precedence in the listen 80 / listen ip:80 statements  
which might be causing the problem.

Steve

–  
Steve H. BSc(Hons) MNZCS

> **[Linux & Admin Support Services | "Services provided by people who are proud...](https://www.greengecko.co.nz)**
>
> Offers linux support services, systems and database administration, consultancy and the full development lifecycle for open source - based solutions

Linkedin: [http://www.linkedin.com/in/steveholdoway](http://www.linkedin.com/in/steveholdoway)  
Skype: sholdowa

---

<div class="post-metadata">

**Author:** ![Paul\_NSPace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Paul\_NSPace](https://www.ruby-forum.com/u/Paul_NSPace)\
**Post date:** [June 18, 2013, 3:47am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356/4 "2013-06-18T03:47:34Z")

</div>

Thank you Steve for nginx -t, and Sajan was correct, I had a syntax  
error in a server block.

However, while I was troubleshooting I noticed my log files getting  
rather huge. I keep the access\_log and error\_log files in the  
directories for each site.

How can I keep these log files to a reasonable size without losing the  
data? (I use Piwik to analyze access logs, so I don’t want to lose any  
data).

Thanks!

---

<div class="post-metadata">

**Author:** ![Paul\_NSPace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ed8c4c/32.png) [@Paul\_NSPace](https://www.ruby-forum.com/u/Paul_NSPace)\
**Post date:** [June 18, 2013, 4:13am UTC](https://www.ruby-forum.com/t/hosting-multiple-domains/235356/5 "2013-06-18T04:13:17Z")

</div>

If it’s a linux server, look at logrotate. This will keep old versions,  
and can also zip them up… being text files they compress very well.

hth,

Steve
