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.
But I am missing something.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
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. <br> <br>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: <br> <br><pre> <br>sudo update-rc.d apache2 disable <br></pre>
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.