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:
- Create the Nginx Proxy Manager directory in a widely accessible location like
/opt
.
# mkdir /opt/nginxproxymanager
- Under the directory, create a new
databases
subdirectory.
# mkdir /opt/nginxproxymanager/databases
- 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:
- Create a custom Docker network.
# docker network create nginxproxyman
- Using a text editor, create and edit a
docker-compose.yml
file in the main/opt/NginxProxy
directory.
# nano /opt/nginxproxymanager/docker-compose.yml
- 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
- 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.
- Save and close the file.
- Switch to the Nginx Proxy Manager directory.
# cd /opt/nginxproxymanager
- Install Nginx Proxy Manager by starting docker-compose in detached mode.
# docker-compose up -d
- 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:
- If you use UFW (enabled by default), allow HTTP access.
# ufw allow 80
- Allow HTTPS access.
# ufw allow 443
- 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:
- Visit your server’s IP address and load the Nginx Proxy Manager web management dashboard on port 81. For example,
http://Server_IP:81
. - Log in to the management dashboard using the default credentials:
- Username: [email protected]
- Password: changeme
- Change your default username, email address, and password to secure the server.
- 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
- 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:
- Click “Add Proxy Host” to enter a domain name.
- Choose between HTTP or HTTPS scheme access.
- Set up the target container name in the “Forward Name/IP” field.
- 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.