Adding New Server Block NGINX

Hello All!

I am trying to parse this tutorial here, but my server configuration is already a little different, so I’m not working from scratch and need some help to make sure I don’t blow anything up.

Right now, most of my files are in /var/www/html – this includes files for three domains. My current server blocks are located not in the sites-available, but in the nginx.conf file. And, they use SSL from LetsEncrypt.

My goal is to add a new domain that’s root is /var/www/ and has a separate LetsEncrypt cert. If it’s okay adding the new server block as a separate file in sites-available, I’d prefer to do that. However, if I need to put it in the nginx.conf with the others, that’s fine too.

I’m just a little unsure how to put it all together.

Any help would be immensely appreciated.



Submit an answer

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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

Does your nginx.conf containes these lines in the bottom of HTTP block ?

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

? If yes. Then just add new config under sites-enabled folder and you’re ready to roll

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel