Nginx 1

April 13, 2020
Nginx Blogging Digital Ocean Web Development

Nginx ~ Subdomains and a Blog

In the previous blog we explored serving a Go web application with Nginx on Digital Ocean. This blog is going to cover how to host a static website on a subdomain. One of the things I did not cover in the last blog is how to point to your domain name with Digital Ocean. For more on this please refer to this blog that I found/used originally.

The first thing to do is copy over your static site using an scp or rsync command. If you’re wondering what the difference between the two like I did, you can refer to this stackexchange answer. I copied my static website to the /var/www directory, but you can choose to store it wherever you would like, just make sure you use that same path in the Nginx configuration.

The next thing to do is create another Nginx server block file in /etc/nginx/sites-available. Add the following to the file.

server {
	root /var/www/fourohfournotfound;

	server_name blog.fourohfournotfound.com www.blog.fourohfournotfound.com;
}

Finally, to add a subdomain to point to the droplet. In my case, since my static website is my blog I am adding blog and www.blog as the hostname directing to the droplet with the static website.

Thanks it! Check out blog.fourohfournotfound.com and learn on!

Nginx 2

April 23, 2020
Nginx Digital Ocean HTTPS Web Development

Nginx 0

April 12, 2020
Nginx Golang Digital Ocean Systemd Web Development

Web701 22

June 15, 2019
Web701 Serverless OpenFaas Docker CLI Python Digital Ocean
comments powered by Disqus