Hello guys!
It's time for me to set up a WWW server on my VPS! I will both set up nginx and secure it by adding an SSL certificate.
Installing nginx
This one is pretty straight-forward.
sudo apt update
sudo apt install nginx
Firewall
Next thing is to allow nginx to connect outside the server. I need to update UFW settings. First thing is to check up what nginx rules I should allow connecting through the firewall:
sudo ufw app list
# Output
Available applications:
Nginx Full
Nginx HTTP
Nginx HTTPS
OpenSSH
I will allow Nginx Full
:
sudo ufw allow "Nginx Full"
Now I should be able to see default nginx page when I hit the IP address of my machine:
I will skip here part of configuring a domain for nginx. I followed this Digital Ocean — only step 5.
SSL
I followed instructions from this tutorial on Digital Ocean, all the steps that are written up there. In step 4. I chose that nginx should redirect all requests to secure HTTPS version.
That's all for today's session. In the next one, I want to set up a database. See you tomorrow!
References
- https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04
- https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04
Top comments (0)