Nginx Proxy Manager is a powerful tool that simplifies the management of reverse proxies and SSL certificates, making it easier to secure and manage web traffic. This guide will walk you through the detailed steps of installing and configuring Nginx Proxy Manager on Ubuntu 22.04, assuming you are using the root user. The article is designed to be technical yet easy to understand for newcomers.
Step 1: Deploying a Cloud Instance on Shape.host
- Log in to Shape.host Dashboard:
- Navigate to the Shape.host website and log in to your account.
- Create a New Instance:
- Click on the “Create” button located at the top right corner of the dashboard.
- From the dropdown menu, select “Instances”.
- Select Instance Location:
- Choose the desired location for your server. For this tutorial, we’ll select “New York, USA”.
- Choose a Plan:
- Select a plan that fits your requirements. For example, you might choose a plan with 2 cores CPU, 2 GB Memory, and 50 GB SSD disk space.
- Select an Operating System:
- Scroll down to the “Choose an image” section and select “Ubuntu 22.04”.
- Configure Additional Options:
- (Optional) You can configure additional options like User Data Configuration and IPv6 Networking.
- Enter a hostname for your instance, e.g., “Tutorial Ubuntu”.
- Click on the “Create instance” button to deploy the instance.
Step 2: Connecting to Your Instance
- Retrieve SSH Credentials:
- Note the IP address of your newly created instance from the Shape.host dashboard.
- Connect via SSH:
- Open a terminal on your local machine.
- Use the following command to connect to your instance:
ssh root@your_instance_ip
- Replace
your_instance_ip
with the actual IP address of your instance.
Step 3: Update System Packages
Before starting the installation process, ensure that your system packages are up-to-date:
apt update
apt upgrade -y
Step 4: Install Docker and Docker Compose
Nginx Proxy Manager requires Docker and Docker Compose to run. Install Docker with the following commands:
apt install -y docker.io
systemctl start docker
systemctl enable docker
Next, install Docker Compose:
apt install -y docker-compose
Step 5: Set Up Docker Compose File
Create a directory for Nginx Proxy Manager and navigate into it:
mkdir -p /srv/nginx-proxy-manager
cd /srv/nginx-proxy-manager
Create and open the docker-compose.yml
file with the following command:
nano docker-compose.yml
Add the following content to the file:
version: '3'
services:
app:
image: 'jc21/nginx-proxy-manager:latest'
restart: always
ports:
- '80:80'
- '81:81'
- '443:443'
environment:
DB_MYSQL_HOST: "db"
DB_MYSQL_PORT: 3306
DB_MYSQL_USER: "npm"
DB_MYSQL_PASSWORD: "npm"
DB_MYSQL_NAME: "npm"
volumes:
- ./data:/data
- ./letsencrypt:/etc/letsencrypt
db:
image: 'jc21/mariadb-aria:latest'
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'rootpassword'
MYSQL_DATABASE: 'npm'
MYSQL_USER: 'npm'
MYSQL_PASSWORD: 'npm'
volumes:
- ./mysql:/var/lib/mysql
Replace rootpassword
with a strong password for the MySQL root user.
Save and close the file by pressing Ctrl+O
, Enter
, and Ctrl+X
.
Step 6: Start Nginx Proxy Manager
With the docker-compose.yml
file in place, start Nginx Proxy Manager using Docker Compose:
docker-compose up -d
This command will download the necessary Docker images and start the containers in the background.
Step 7: Access Nginx Proxy Manager
Once the containers are up and running, you can access Nginx Proxy Manager through your web browser. Open your browser and navigate to http://your_server_ip:81
.
The default login credentials are:
- Email:
admin@example.com
- Password:
changeme
After logging in, you should immediately change the default credentials.
Step 8: Configure Nginx Proxy Manager
After logging in, you can start configuring Nginx Proxy Manager. Here are the basic steps to set up a proxy host:
- Add Proxy Host:
- Go to the “Hosts” section and click “Proxy Hosts”.
- Click “Add Proxy Host”.
- Enter the domain names you want to use.
- Set the scheme (http or https), the forward hostname/IP, and the forward port.
- Enable “Block Common Exploits” and “Websockets Support” if needed.
- SSL Certificates:
- If you need SSL, go to the “SSL” tab.
- Choose “Request a new SSL Certificate”.
- Enter your email address for Let’s Encrypt notifications and agree to the terms.
- Enable “Force SSL” to ensure all traffic is encrypted.
- Advanced Configuration:
- Use the “Advanced” tab to add any custom Nginx configurations if required.
- Save Configuration:
- Click “Save” to apply the settings.
By following these steps, you should have a fully functional Nginx Proxy Manager set up on your Ubuntu 22.04 server, allowing you to manage your reverse proxies and SSL certificates with ease.
For enhanced performance and reliability, consider using Shape.Host’s Cloud VPS services. Shape.Host offers robust solutions for hosting your Nginx Proxy Manager in the cloud, providing high availability, security, and scalability for your web traffic management needs. Explore more about their services at Shape.Host.