Compute Engine Google Cloud

Install Nginx on Debian 10 – Google Cloud

How to Install Nginx on Debian 10. Nginx is high performance light-weight HTTP and reverse proxy web server capable of handling large websites. This guide explains how to install Nginx and details of the installation on Debian 10.

This tutorial is tested on Google Compute Engine VM Instance running Debian 10. This setup will also work on other cloud services like AWS, DigitalOcean, etc or any VPS or Dedicated servers.

Learn AWS fundamental concepts including Regions, Availability Zones, and Virtual Private Clouds (VPCs)

Prerequisites

  1. A running system or server or a virtual machine with Debian 10
  2. Minimal experience in running SSH shell commands.

Update Packages

Start by updating the packages to the latest available version using the following commands.

sudo apt update
sudo apt upgrade

Once you have all packages are up to date you can proceed to install Nginx.

Install Nginx on Debian 10

Nginx is available in the default Debian 10 repositories. So it is easy to install Nginx with just a single command.

sudo apt install nginx

Once the installation is completed, Nginx will start automatically.

Verify the Installation

To verify the status of the Nginx service you can use the status command.

sudo systemctl status nginx
● nginx.service - The nginx HTTP and reverse proxy server
    Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
    Active: active (running) since Wed 2019-12-02 11:37:16 UTC; 27s ago

This indicates Nginx is up and running on your Debian 10 server.

Configure UFW/Firewall for Nginx

Debian does not install UFW by default, so you need to install it using the following command.

sudo apt install ufw

Allow connections to SSH and the ports for Nginx.

sudo ufw allow ssh
sudo ufw allow 'Nginx Full'

Enable UFW.

sudo ufw enable

To check the status you can use the following command.

sudo ufw status verbose

Now you can check your browser by pointing it to your public IP address (http://IP_Adddress).

You will see the Nginx welcome page.

Nginx welcome page

Nginx Configuration Details

  • Nginx location: /etc/nginx
  • Main Nginx configuration file: /etc/nginx/nginx.conf
  • Additional Nginx configuration files for websites: /etc/nginx/sites-available
  • Enabled Nginx configuration files for websites: /etc/nginx/sites-enabled
  • Default web root for the your website: /var/www/html
  • Nginx error log file: /var/log/nginx/error.log
  • Nginx access log file: /var/log/nginx/access/log

Conclusion

Now you have learned how to install Nginx on your Debian 10 server on any hosting platforms.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Cloudbooklet builds a large collection of Linux based guides and tutorials on Cloud platforms like Google Cloud, AWS, Azure, DigitalOcean and more

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.