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:
- 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…
- Ubuntu Install Nginx Php7.2 Mysql Ubuntu Install Nginx Php7.2 Mysql What is Nginx? Nginx is an open source web server that is very popular for powering web applications such as WordPress and Drupal. It is…
- Deploy Laravel Nginx Ubuntu 17 Deploy Laravel Nginx Ubuntu 17 Requirements for Installing Laravel 5.4 on Ubuntu 17 This article will guide you through the process of installing Laravel 5.4 on Ubuntu 17. Before we…
- 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…
- Node Express Mongodb Nginx Digitalocean Node Express Mongodb Nginx Digitalocean Creating a Machine Through DigitalOcean Droplet Creating a DigitalOcean Droplet is the simplest and most fool-proof way of setting up a more secure and private…
- Install Nginx Passenger Ubuntu 16.04 Install Nginx Passenger Ubuntu 16.04 Installing Nginx On Ubuntu 16.04 Nginx is an open source web server that can be used to create web and application servers. It is a…
- Install Nginx Windows Server 2008 Install Nginx Windows Server 2008 What is Windows Server 2008? Windows Server 2008 is a server operating system made by Microsoft that builds on the Windows NT kernel. It was…
- Lokasi Site Available Nginx Centos 7 Lokasi Site Available Nginx Centos 7 What is Nginx? Nginx is an open source web server software. It is very fast and easy to configure. It supports a variety of…
- 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.…
- Nginx Php-Fpm Php Mariadb Mysql Centos 7.2 Digitalocean Nginx, Php-Fpm, Php, Mariadb, Mysql, Centos 7.2 Digitalocean Introduction: What is Nginx? Nginx is a powerful web server that was first released in 2004. It is known for being a…
- Install Nginx Centos 7 Offline Install Nginx Centos 7 Offline Introduction Nginx is an open-source web server software, which is used to serve web pages and associated content. It is a fast, reliable, and robust…
- 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…
- Wordpress Nginx Ubuntu 18.04 Wordpress Nginx Ubuntu 18.04 Overview WordPress is a popular web software used by millions of people around the world. It allows users to easily create and manage websites without the…
- 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…
- Install Wordpress On Ubuntu Vps On Nginx Install Wordpress On Ubuntu VPS On Nginx What is WordPress? WordPress is an open-source, content management system (CMS) top-tier overall that is used to create powerful online presence. It powers…
- Site-Available Nginx Whas Delete Ubuntu Site-Available Nginx What Delete Ubuntu What is Nginx and how does it work with Ubuntu? Nginx is a web server designed for high performance, scalability, and reliable internet connectivity. It…
- Nginx Sites Availeble Digital Ocean Nginx Sites Available Digital Ocean What is a Nginx Site? In the world of hosting providers, Nginx (pronounced “engine x”) is one of the popular choices to host your website.…
- Install Nginx Php Oracle Ubuntu Install Nginx, Php, Oracle, Ubuntu Installing Nginx on Ubuntu Nginx is a popular web server software based on the LEMP stack that is widely used to host web applications, especially…
- Nginx Port 3000 To 80 Digitalocean Nginx Port 3000 To 80 Digitalocean What is Nginx? Nginx is an open source web server that is designed to provide a better experience when hosting a website. It is…
- Nginx Free Ssl Digital Ocean Nginx Free SSL on Digital Ocean What is Nginx? Nginx is an open-source web server software used for content caching, server-side scripting, proxy server configuration, and other functions. It is…
- Install Nginx And Php On Ubuntu Install Nginx And Php On Ubuntu A Comprehensive Tutorial to Install Nginx And Php On Ubuntu Nginx and PHP are two of the most popular web server and scripting language…
- Nginx Php-Fpm Php Stack Overflow Articel Nginx Php-Fpm Php Stack Overflow Articel What Is Nginx? Nginx (pronounced engine-x) is an open source web server and reverse proxy software that is popular for its high performance and…
- Digital Ocean Ubuntu Server Nginx Digital Ocean Ubuntu Server Nginx Introducing Digital Ocean Digital Ocean, a leader in cloud hosting, provides high-performance server instances, unlimited storage, and multiple configurations for all types of digital demands.…
- Error 404 Because Server Nginx 1.14.0 Ubuntu… Error 404 Because Server Nginx 1.14.0 Ubuntu Transfer-Encoding Chunked Introduction to Error 404 Error 404 is a response code indicating that a page or file you have requested cannot be…
- Create Wordpress With Nginx Mariadb Php-Fpm 16.04 Create WordPress With Nginx Mariadb Php-Fpm 16.04 What Is WordPress? WordPress is a content management system (CMS) and a blogging platform. It allows you to easily create and manage websites…
- Setting Php Nginx Ubuntu Vps Setting Up a PHP, Nginx, and Ubuntu VPS What is a VPS? A Virtual Private Server (VPS) is a type of virtualized hosting. It works in the same way as…
- 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…
- Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 Install Nginx Php Mysql Ssl & Wordpress On Ubuntu 18.04 What is Nginx, Php, Mysql, SSL and Wordpress? Nginx is a high-performance web server that is widely used to serve…
- Install Odoo 11 Nginx Ubuntu 16 Install Odoo 11 Nginx Ubuntu 16 What is Odoo 11 Nginx? Odoo 11 Nginx is an open source software package designed to facilitate secure and reliable web development. It is…
- Vps Webserver Nginx Php7 Mysql Vps Webserver Nginx Php7 Mysql What Is VPS Webserver? A VPS webserver is a Virtual Private Server (VPS) that has been configured to act as a web server. A VPS…