Apr 15, 2025

Ubuntu : Nginx Proxy Manager (NPM)

Nginx Proxy Manager (NPM) is a user friendly, open source tool that simplifies the management of Nginx Reverse Proxy configurations. It have a Web UI for creating and managing Proxy Hosts, SSL Certificates and User Management and Permissions.

NPM makes managing services exposed to the Internet easily and securely. For easy installation and consistent environment, NPM runs on Docker.

Let's Get Started !

1. Install Docker's GPG Key.

sudo apt install ca-certificates curl gnupg -y


2. Modify the permission for "keyrings".

sudo install -m 0755 -d /etc/apt/keyrings


3. Download Docker's GPG Key.


sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc



4. Grant required permissions.

sudo chmod a+r /etc/apt/keyrings/docker.asc


5. Add Docker to the Repository.

echo \


"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \



$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \


sudo tee /etc/apt/sources.list.d/docker.list > /dev/null


6. Update the Repository.

sudo apt update


7. Install Docker.


sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y



8. Test Docker installation.

sudo docker run hello-world


9. Enable and Start Docker.

sudo systemctl enable docker

sudo systemctl start docker


10. Add "docker" to User group.

sudo usermod -aG docker $USER


11. Install Docker Compose.


sudo curl -SL https://github.com/docker/compose/releases/download/v2.34.0/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose



12. Modify Docker Compose Permission.

sudo chmod +x /usr/local/bin/docker-compose


13. Test the Docker Compose.

sudo docker-compose


14. Create a installation folder for Nginx Proxy Manager.

sudo mkdir ~/nginx-proxy


15. Change directory into the newly created folder.

cd ~/nginx-proxy


16. Create sub-folders inside "nginx-proxy" folder.

sudo mkdir {data,letsencrypt}


17. Create Docker Compose file inside "nginx-proxy" folder.

sudo nano docker-compose.yml


18. Copy and Paste the following codes into the file. You might want to check for the latest configuration at (https://nginxproxymanager.com/setup/#using-mysql-mariadb-database)


services:
    app:
        image: 'jc21/nginx-proxy-manager:latest'
        restart: unless-stopped
        ports:
            # These ports are in format <host-port>:<container-port>
            - '80:80' # Public HTTP Port
            - '443:443' # Public HTTPS Port
            - '81:81' # Admin Web Port
            # Add any other Stream port you want to expose
            # - '21:21' # FTP
        environment:
            # Mysql/Maria connection parameters:
            DB_MYSQL_HOST: "db"
            DB_MYSQL_PORT: 3306
            DB_MYSQL_USER: "npm"
            DB_MYSQL_PASSWORD: "npm"
            DB_MYSQL_NAME: "npm"
            # Uncomment this if IPv6 is not enabled on your host
            # DISABLE_IPV6: 'true'
        volumes:
            - ./data:/data
            - ./letsencrypt:/etc/letsencrypt
        depends_on:
            - db

    db:
        image: 'jc21/mariadb-aria:latest'
        restart: unless-stopped
        environment:
            MYSQL_ROOT_PASSWORD: 'npm'
            MYSQL_DATABASE: 'npm'
            MYSQL_USER: 'npm'
            MYSQL_PASSWORD: 'npm'
            MARIADB_AUTO_UPGRADE: '1'
        volumes:
            - ./mysql:/var/lib/mysql



19. Create Docker Network for Nginx Proxy Manager.

sudo docker network create npm-nw


20. Start Nginx Proxy Manager.

sudo docker-compose up -d


21. Check the Docker Status.

sudo docker ps


22. Open favorite browser (eg. Google Chrome) and browse the following address. You should be able to see a Nginx Proxy Manager Welcome Page.

http://[IP Address]


23. Now login to Nginx Proxy Manager Admin Web UI, please note the port number is 81.

http://[IP Address]:81


24. Login with the default Username and Password as below.


Default Username    : admin@example.com

Default Password    : changeme



25. After successfully login, you will be prompted to change the Username and Password, please proceed to change it accordingly and remember the new Username and Password.



!!! HAPPY COMPUTING !!!

No comments:

Post a Comment