Article directory
Preface
Nginx Proxy Manager is an open source reverse proxy tool that can quickly expose your service to the external environment without knowing much about Nginx or Letsencrypt, and supports SSL configuration. Based on the beautiful and secure management interface of Tabler, you can easily create forwarding domains, redirects, flows and 404 hosts without knowing Nginx.
The following describes how to install Nginx Proxy Manager on Linux and combine it with the cpolar intranet penetration tool to achieve remote access to the management interface. Similarly, when we use Nginx Proxy Manager to configure other local services and require remote access, the same method is used.
1. Docker one-click installation
Enter the command and start docker with one click:
docker run -d -p 80:80 -p 81:81 -p 443:443 --restart=always -v ~/data:/data -v ~/letsencrypt:/etc/letsencrypt jc21/nginx-proxy-manager:latest
After running, enter docker ps to see the running container. The command mounts three ports. Ports 80 and 443 are the ports for accessing the service, and port 81 is the Nginx Proxy Manager management page port.
2. Local access
After the above service is set up, first access the management interface of port 81. You can see the login interface of Nginx Proxy Manager. Enter the default account: [email protected] and the default password: to changeme
log in. This is Linux internal browser access. For LAN IP access, you need to check whether the firewall is turned off! After local access is correct, install the cpolar intranet penetration tool below.
3. Linux installation cpolar
Above we deployed Nginx Proxy Manager on Linux. Next we installed the cpolar intranet penetration tool on Linux and forwarded the http public network address mapped by the local port through cpolar. We can easily achieve remote access without registering a domain name and purchasing a cloud server. .The following are the steps to install cpolar
cpolar official website address: https://www.cpolar.com
- Use one-click script installation command
curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash
- Add services to the system
sudo systemctl enable cpolar
- Start cpolar service
sudo systemctl start cpolar
After cpolar is successfully installed, access Linux port 9200 on an external browser: [http://LAN ip:9200]. Log in using your cpolar account. After logging in, you can see the cpolar web configuration interface, which is connected to the web management interface. Just configure
4. Configure public network access address
Here, the internal nginx proxy forwarding mechanism of Nginx Proxy Manager is used, combined with the public network address of cpolar, to realize the forwarding of local port 81. The Nginx Proxy Manager web management interface service can be accessed remotely.
Click Tunnel Management - Create Tunnel on the left dashboard to create a cpolar public network address tunnel of Nginx Proxy Manager!
- Tunnel name: You can customize the name. Be careful not to duplicate the existing tunnel name.
- Protocol: Select http
- Local address: 81 (port of local service)
- Domain name type: Choose a random domain name for free
- Region: Select China vip
Click创建
After the tunnel is successfully created, click the status on the left - Online Tunnel List to view the generated public network access address. There are two access methods, one is http and https, and then copy the public network address generated by cpolar, the previous http ://Protocol name does not need to be copied!
Open the Nginx Proxy Manager management interface, log in, and click Add Proxy Host
,
Enter the cpolar domain name Domain Names
, enter the port of the local service and the local IP below. What is demonstrated here is to configure the Nginx Proxy Manager web management interface. If it is other services, you can change the port to other service ports. After inputting, click Save
5. Public network remote access
After the above addition is completed, you can see an added record in the management interface list, and it is Online.
At this time, you can use the cpolar public network address to access the Nginx Proxy Manager management interface on any device browser. HTTP access is used here, and https needs to be configured separately. For details, please refer to the official documentation
6. Fixed public network address
Since the tunnel created using cpolar above uses a random public network address, it will change randomly within 24 hours, which is not conducive to long-term remote access. Therefore, we can configure a second-level subdomain name for it. This address is a fixed address and will not change randomly [ps: cpolar.cn has been filed]
Note that you need to upgrade the cpolar package to a basic package or above, and the bandwidth corresponding to each package is different. [cpolar.cn has been registered]
Log in to the cpolar official website , click Reserve on the left, select to reserve the second-level subdomain name, set a second-level subdomain name, click Reserve, and copy the reserved second-level subdomain name after the reservation is successful.
After the reservation is successful, copy the name of the second-level subdomain name that was successfully reserved.
Return to the cpolar web UI management interface, click Tunnel Management - Tunnel List on the left dashboard, find the tunnel you want to configure, and click Edit on the right
Modify the tunnel information and configure the successfully reserved second-level subdomain name into the tunnel.
- Domain name type: Select a second-level subdomain name
- Sub Domain: Fill in the successfully reserved second-level subdomain name
Click 更新
(note, click once to update, no need to submit again)
After the update is completed, open the online tunnel list. At this time, you can see that the public network address has changed, and the address name has also become a domain name of a fixed second-level subdomain name. We configure the fixed domain name to the Nginx management interface.
Edit the record we added above,
Then we change the cpolar random address to a fixed address and click Save
After saving, you can see that the address in the list has changed to a fixed public network address.
Use the cpolar public network address and open it in any browser to access our local services
Reprinted from cpolar pole cloud article: Nginx visual management tool + Cpolar configure remote access to local services