Cant setup subdomain (address in use)?

April 26, 2014 1.2k views
I am not seting up my nginx virtial host blocks up properly, but I don't get how to serve a subdomain on port:80 and the main domain on port:80? I tried creating multiple virtual hosts, but I was getting an error with server_names_hash_bucket_size 64; I had to uncomment that out inside nginx.conf to get it work and at this point I already went ahead an merged both virtual hosts into the default file. server { listen 80; root /var/www/example.com/public_html/public; index index.html index.htm; # Make site accessible from http://example.com server_name example.com; } server { listen 80; root /var/www/demo.example.com/public_html; index index.html index.htm; # Make site accessible from http://demo.example.com server_name demo.example.com; } Obviously I am pointing both to port:80 but I am not sure how to configure it so they both work on port:80. I followed https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3 But I am missing something.
2 Answers
Oh it looks like when you restart your droplet apache2 starts on its own... I stoped apache2 as a service, and restarted nginx , it appears to be working.

I also uncommented port:80 on the second virtual host for my subdomain, so it's working not. I need to uninstall apache..
If for some reason you want to keep Apache installed, but set it so that it doesn't automatically start on boot, you can run:


sudo update-rc.d apache2 disable
Have another answer? Share your knowledge.