Digitalocean Install Nginx Ubuntu 18.04
Introducing DigitalOcean and Nginx
DigitalOcean is a virtual cloud server provider, allowing users to spin up virtual servers located in various geographical locations throughout the world. They provide an excellent platform for running a website, game server, or any other sort of hosting service. DigitalOcean also makes it easy to install software packages, such as web servers and databases.
Nginx is an open source (free) web server and proxy server, popular in many circles as a lightweight and robust web server. Nginx is used in a variety of applications for web hosting and development, including static sites, video streaming sites, and applications.
In this article, we’ll walk you through the steps for installing Nginx on an Ubuntu 18.04 DigitalOcean droplet. This is a relatively simple process, and you don’t need any previous server administration experience. Let’s get started!
Step 1 — Installing Nginx
The first step to installing Nginx is to make sure that the latest version of the web server is installed on the droplet. We can do this by running the update command:
sudo apt-get update
Next, we’ll install the Nginx web server with the following command:
sudo apt-get install nginx
Once the installation is complete, Nginx should be up and running. You can test this by visiting the IP address of your droplet in a web browser. You should see the default Nginx page which looks like the following:

If you see this page, Nginx is installed and running correctly.
Step 2 — Configuring Firewall Settings
Before we can begin serving content with Nginx, we’ll need to configure our firewall to allow traffic on port 80. By default, Ubuntu’s ufw firewall should be enabled, blocking all incoming traffic. To allow connections on port 80, we’ll need to open this port with the following command:
sudo ufw allow http
You can check the status of the firewall afterwards by typing:
sudo ufw status
You should see that port 80 is now allowed.
Step 3 — Configuring Nginx
Now that Nginx is installed and our firewall is configured, we’ll need to make some changes to Nginx’s configuration file. Open the file in a text editor with the following command:
sudo vi /etc/nginx/sites-available/default
The configuration file should look like this:

Make the following changes to the configuration file:
- Change
server_name _;
to server_name ;
- Replace
/var/www/html;
with /var/www/html/public_html;
Save and close the file when you are finished. Then, we can enable our changes by typing:
sudo systemctl restart nginx
Step 4 — Serving Content with Nginx
Now that Nginx is configured and running, let’s test it by creating a web page. Create a directory for your web page with the command
sudo mkdir -p /var/www/html/ public_html
. Next, create a sample page with the following command:
sudo vi/var/www/html/public_html/ index.html
Add the following HTML code to the file and save it:
My First Web Site
Hello World!
Now, if you visit the IP address of your droplet in your web browser, you should see the “Hello World!” page that you just created.
Conclusion
In this article, we saw how to install and configure the Nginx web server on an Ubuntu 18.04 DigitalOcean droplet. We also saw how to create a web page and test it in the browser. Now you are ready to serve content on your Nginx server!
Frequently Asked Questions (FAQs)
Q: How can I make sure that Nginx is running?
A: You can check the status of Nginx by running the following command:
sudo systemctl status nginx
Q: How can I make sure that my firewall is configured correctly?
A: To check the status of your firewall, run the command
sudo ufw status
. This will show you all of the ports that are currently allowed or denied.
Q: How do I create a web page on my server?
A: You can create a web page by creating a directory for it, such as
/var/www/html/public_html
, and then creating and saving an HTML file in that directory. You can then view the page in your web browser by visiting the IP address of your droplet.
Thank you for reading this article. If you enjoyed reading this article, please check out our other articles.
Related Posts:
- Docker Nginx Php Mysql In Xampp Docker Nginx Php Mysql In Xampp Overview of Docker Nginx Php Mysql in Xampp Docker Nginx Php Mysql in Xampp is a powerful web development platform used for developing complex…
- Ubuntu Server Postgresql Nginx Php Digitalocean Laravel Ubuntu Server Postgresql Nginx Php Digitalocean Laravel Introduction To The Stack Ubuntu Server, Postgresql, Nginx, PHP, Digitalocean and Laravel are an exceptional combination of elements that, when put together, make…
- Create Domain Using Nginx Virtualmin Title: Create Domain Using Nginx Virtualmin Create Domain Using Nginx Virtualmin What is Nginx Virtualmin? Nginx Virtualmin is an automated website management platform from Virtualmin. It provides a powerful web…
- Digitalocean Letsencrypt Nginx Ubuntu 18.04 Digitalocean Letsencrypt Nginx Ubuntu 18.04 Introduction Ubuntu 18.04 is the latest version of the popular Linux operating system. Digitalocean is a cloud hosting provider that specializes in hosting and managing…
- How To Debian Nginx Php How To Debian Nginx Php Step 1 – Setup Your VPS The first step to setting up your web server is getting your VPS (Virtual Private Server). This is usually…
- Cacti Nginx Php-Fpm Alpine Cacti Nginx Php-Fpm Alpine What is Cacti? Cacti is an open-source network monitoring and infrastructure management solution that offers an easy-to-use graphical interface for graphing, logging, and analyzing network traffic.…
- How Use Nginx Mysql Ubuntu How to Use Nginx, MySQL and Ubuntu What is Nginx? Nginx is an open source web server and reverse proxy software written by Igor Sysoev. It is a popular choice…
- Hhvm Nginx Ubuntu 16.4 HHVM Nginx Ubuntu 16.4 What is HHVM? HHVM, also known as HipHop Virtual Machine, is a virtual machine developed by Facebook to speed up the execution of PHP code. It…
- Remove Apache And Install Nginx Centos 7 Remove Apache And Install Nginx Centos 7 Introduction Apache is an open source HTTP server used for hosting websites and web applications on the web. Although Apache is reliable and…
- Check Nginx Status Ubuntu 16.04 Check Nginx Status Ubuntu 16.04 What is Nginx? Nginx (pronounced "engine x") is an open source web server that is used for hosting websites and applications on a wide range…
- Install Phpmyadmin On Nginx Ubuntu 18.04 Install Phpmyadmin On Nginx Ubuntu 18.04 Introduction PhpMyAdmin is one of the most popular and widely used web-based database management tools available. It is used for administering, managing and maintaining…
- Stop Nginx Ubuntu 16.04 Stop Nginx Ubuntu 16.04 What is Nginx? Nginx is a web server and reverse proxy software. It is open source and widely used on the web. It is used to…
- Nginx Wordpress Ubuntu 18.04 Nginx Wordpress Ubuntu 18.04 Introduction to Nginx Nginx is a web server software for hosting websites and applications. It is open-source and highly configurable, making it a popular choice for…
- Create Virtual Host Nginx Centos 7 Create Virtual Host Nginx Centos 7 What is a Virtual Host? A virtual host is a server hosting multiple domain names on the same web server. This type of hosting…
- Google Cloud Ubuntu 16 Install Nginx Php Google Cloud Ubuntu 16 Install Nginx Php 1. What is Nginx? Nginx is a powerful open source web server. It is used to serve web pages to the internet and…
- Install Nginx And Php Scract In Docker Install Nginx And PHP Script in Docker What is Docker? Docker is a popular platform for creating, running, and managing applications in a lightweight container system. Originally released as an…
- 403 Forbidden Nginx Ubuntu 14.04 403 Forbidden Nginx Ubuntu 14.04 What Is a 403 Forbidden Error? A 403 Forbidden error is an HTTP status code that denotes that a server, upon receiving a request from…
- Instal Nginx Ubuntu 18.04 Installing Nginx on Ubuntu 18.04 What is Nginx? Nginx is a lightweight, open source, high-performance web server designed for serving dynamic and static web content. It is capable of handling…
- Nginx Com Vs Nginx Org Nginx Com Vs Nginx Org What is Nginx Com? Nginx Com is a commercial and open source web server and a reverse proxy developed and maintained by Nginx Incorporated. Founded…
- Cara Install Nginx Ubuntu 14.04 Cara Install Nginx Ubuntu 14.04 Step 1: Update the Software Packages The first step in installing Nginx is to update the software packages in Ubuntu 14.04. This can be done…
- Default_Server Nginx Conf Digital Ocean Directory Default_Server Nginx Conf Digital Ocean Directory Introduction to Nginx & Digital Ocean Directory Nginx and Digital Ocean Directory make an excellent pair when it comes to setting up web servers.…
- Install Nginx Phpmyadmin Centos 7 Install Nginx Phpmyadmin Centos 7 What is Nginx? Nginx is a web server that is used in Linux-based operating systems such as Centos 7. It is designed to handle high-traffic…
- How To Configure Https Owncloud Using Nginx Ubuntu How To Configure Https Owncloud Using Nginx Ubuntu What Is OwnCloud? OwnCloud is an open-source file synchronization and hosting service. It is developed primarily to provide a web service, allowing…
- Can I Install Phpmyadmin In Nginx Can I Install Phpmyadmin In Nginx? PHPmyadmin is a web-based management tool for databases such as MySQL and MariaDB. It is a popular tool for web developers and database administrators…
- How To Ufw Allow Nginx Http Digitalocean How To Ufw Allow Nginx Http Digitalocean What is UFW for Nginx on DigitalOcean? UFW (Uncomplicated Firewall) is a firewall application package for use with the Ubuntu Linux operating system.…
- How To Fix 502 Bad Gateway Nginx On Digitalocean How To Fix 502 Bad Gateway Nginx On Digitalocean What Is 502 Bad Gateway Nginx? 502 Bad Gateway Nginx is an error code returned by the server to indicate that…
- Install Php Nginx Mysql Ubuntu 18.04 Install Php Nginx Mysql Ubuntu 18.04 What is PHP, Nginx, and MySQL PHP is a popular and powerful scripting language that can be used to create dynamic web pages, web…
- Nginx 502 Bad Gateway Php Wordpress Digitalocean Nginx 502 Bad Gateway Php Wordpress Digitalocean Introduction to 502 Bad Gateway A 502 Bad Gateway is an HTTP status code that is displayed when the server acting as a…
- Install Phpmyadmin On Nginx Ubuntu Install Phpmyadmin On Nginx Ubuntu What Is Phpmyadmin? Phpmyadmin is a free, open source web application written in PHP specifically designed to help manage MySQL databases. It is a powerful…
- How To Install Flask Nginx On Ubuntu 1604 How To Install Flask Nginx On Ubuntu 1604 Introduction Flask is a web application framework based on Python. It is highly useful for web developers due to its flexibility and…