‍‍

Nginx Proxy Manager is a powerful tool that allows you to manage and configure reverse proxies, security exceptions, streams, and SSL certificates through a user-friendly web interface. In this tutorial, we will guide you through the process of installing Nginx Proxy Manager on a Virtual Private Server (VPS) operating Ubuntu Server 22.04. By following these steps, you will be able to set up Nginx Proxy Manager on your Docker-powered Ubuntu server.

Step 1: Setup the Database and Data Directories

Before installing Nginx Proxy Manager, you need to set up the necessary directories and create a database. Follow these steps to get started:

  1. Create the Nginx Proxy Manager directory in a widely accessible location like /opt.
# mkdir /opt/nginxproxymanager
  1. Under the directory, create a new databases subdirectory.
# mkdir /opt/nginxproxymanager/databases
  1. Create a new SQLite database file using the following command.
# touch /opt/nginxproxymanager/databases/nginxproxy.db

Step 2: Install Nginx Proxy Manager

Now that the database and data directories are set up, it’s time to install Nginx Proxy Manager. Follow these steps:

  1. Create a custom Docker network.
# docker network create nginxproxyman
  1. Using a text editor, create and edit a docker-compose.yml file in the main /opt/NginxProxy directory.
# nano /opt/nginxproxymanager/docker-compose.yml
  1. Enter the following configurations to the file:
version: "3"
services:
  app:
    image: "jc21/nginx-proxy-manager:latest"
    container_name: "nginxproxymanager"
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
      - "81:81"
    environment:
      DB_SQLITE_FILE: "/data/database.sqlite"
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
networks:
  default:
    external:
      name: nginxproxyman
  1. Nginx Proxy Manager listens on ports 80 and 443 for HTTP and HTTPS traffic, respectively. Port 81 provides access to the web management dashboard. To tighten server security, change the management port to a random combination.
  2. Save and close the file.
  3. Switch to the Nginx Proxy Manager directory.
# cd /opt/nginxproxymanager
  1. Install Nginx Proxy Manager by starting docker-compose in detached mode.
# docker-compose up -d
  1. Verify that Nginx Proxy Manager is up and running.
# docker ps

The command output should display the running container:

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
f3a37d391293        jc21/nginx-proxy-manager:latest"/init"33 minutes ago      Up33 minutes0.0.0.0:80-81->80-81/tcp,0.0.0.0:443->443/tcp   nginxproxymanager

Step 3: Configure Firewall

To ensure that your server is properly protected, you need to configure the firewall to allow access to the necessary ports. Follow these steps:

  1. If you use UFW (enabled by default), allow HTTP access.
# ufw allow 80
  1. Allow HTTPS access.
# ufw allow 443
  1. Allow access to the Nginx Proxy Manager web management dashboard.
# ufw allow 81

Step 4: Setup Nginx Proxy Manager

With the installation and firewall configuration complete, it’s time to set up Nginx Proxy Manager. Follow these steps:

  1. Visit your server’s IP address and load the Nginx Proxy Manager web management dashboard on port 81. For example, http://Server_IP:81.
  2. Log in to the management dashboard using the default credentials:
  • Username: [email protected]
  • Password: changeme
  1. Change your default username, email address, and password to secure the server.
  2. To proxy and forward requests to a backend application, you can attach a Docker container to the Nginx Proxy Manager network. For example, the following command creates a new ownCloud container attached to the nginxproxyman network.
# docker run --network nginxproxyman --name owncloud -d owncloud:latest
  1. Access the Nginx Proxy Manager web dashboard and navigate to “Hosts” on the main navigation menu.

Step 5: Setup your Domains

To configure your domains in Nginx Proxy Manager, follow these steps:

  1. Click “Add Proxy Host” to enter a domain name.
  2. Choose between HTTP or HTTPS scheme access.
  3. Set up the target container name in the “Forward Name/IP” field.
  4. Toggle “Save” to continue.

By following these steps, you have successfully installed and configured Nginx Proxy Manager on your Ubuntu Server 22.04. You can now manage and configure reverse proxies, security exceptions, streams, and SSL certificates through the user-friendly web interface.

If you are looking for reliable and efficient cloud hosting solutions, Shape.host offers SSD Linux VPS services that can cater to your needs. With their scalable and secure infrastructure, you can trust Shape.host to provide you with top-notch hosting solutions.