What is Nginx Proxy Manager (NPM)?
Nginx Proxy Manager (NPM) is an open-source web interface with reverse proxy capabilities. NPM allows users to create and manage virtual hosts, redirects, SSL certificates, and security rules for their proxy servers. NPM makes configuring Nginx much easier for users who are not familiar with the command line, and also makes it easy to redirect multiple websites.
What is a Reverse Proxy?
A reverse proxy is a web server that acts as an intermediary between clients (e.g., a web browser) and backend servers (e.g., a web server). In other words, the reverse proxy receives requests from clients and redirects them to the appropriate servers to handle the request.
To learn more about this, you can consult the article from it-connect.fr .
Installing Nginx Proxy Manager with Docker
NPM runs as a docker container . So you first need to have a docker server (See our tutorial “ Docker Installation Tutorial ”) and then you will need to install docker and docker-compose on your new server.
sudo apt updatesudo apt install docker.io docker-compose -y
Once docker is properly installed, we will create the docker-compose file
nano docker-compose.yml
Then add the following lines to the file
Don't forget to change the root/user user and password in the file!
Finally run the following command to launch the container
docker-compose up -dIt will take a little while, but once done, the Nginx Proxy Manager installation will be complete.
Nginx Proxy Manager web interface
You can access the web interface by typing the IP address of the server where you installed NPM and the admin port specified in the docker-compose.yml file (port 81 by default).
The default identifiers are:
Email address: admin@example.com
Password: changeme
NPM will make you change them on the first login.
Using and Configuring NPM
Now that you have installed Nginx Proxy Manager, you can start using it to configure reverse proxies. Here are the steps to add a new proxy host:
- Go to Proxy Hosts > Add Proxy Host
-
In the Details section:
- Domain Names: The desired subdomain name
- Scheme: Http or https (set depending on the redirected web page)
- Forward Hostname/IP: The IP address where the request will be redirected
- Forward Port: The desired listening port
-
In the SSL section:
- Force SSL: Will force the client to be in HTTPS
- Email address: The address that will be provided in the certificate
Once all the information is filled in, press “Save” and the proxy host should appear as “Online” in your list
All you have to do now is test whether you can access the domain name.
Have access from outside the network
Thanks to what we saw before, the NPM reverse proxy works, but only locally, so we will see how to make it work from outside the network.
First, we will need to open ports 80 and 443 on your router for Nginx.
Then, at your domain name provider, you need to create the subdomain and a DNS record for the subdomain you want to use and point it to the public IP address of your box.
Example under Hostinger:
You should now have access to your services from outside.
A need? A project? We answer your questions at 02.51.99.13.03 or by email at contact@sparwan.com.