Nginx Proxy Manager Configuration Guide for URL Redirection
Overview:
Nginx Proxy Manager is a graphical interface management tool based on Nginx, which can be easily The configuration implements URL redirection. This article will introduce how to configure using Nginx Proxy Manager and provide specific code examples.
Step 1: Install Nginx Proxy Manager
First, you need to install Nginx Proxy Manager on the server. It can be installed in the Ubuntu system through the following command:
sudo apt-get update sudo apt-get install nginx sudo apt-get install certbot
Step 2: Configure Nginx Proxy Manager
Once the installation is complete, it can be configured through the web interface. Enter the server's IP address or domain name in the browser, and visit the following URL: http://server IP address: 81 (please modify the IP address according to the actual situation).
After entering the management interface of Nginx Proxy Manager, click the "Proxy Hosts" option in the left menu bar, and then click the "Add Proxy Host" button.
In the pop-up page, you need to fill in the following content:
Click the "Save" button to save the configuration.
Step 3: Apply for an SSL certificate for the domain name
If you want to use an SSL certificate for the redirected domain name, you need to apply for a free SSL certificate. You can use Certbot to apply.
sudo certbot certonly --standalone -d 你的域名
After the application is successful, Certbot will automatically save the SSL certificate to the server.
Step 4: Configure SSL Certificate
Return to the management interface of Nginx Proxy Manager, click the "Proxy Hosts" option in the left menu bar, find the proxy host just added, and click the corresponding "Edit" "Button.
In the pop-up page, you can see the "SSL" column. Select the "Custom" option and fill in the following:
Click the "Save" button to save the configuration.
Step 5: Restart the Nginx service
Finally, execute the following command on the server to restart the Nginx service.
sudo service nginx restart
After completing the above steps, the URL redirection configuration is complete. When accessing the configured domain name, Nginx will automatically redirect the request to the specified target address.
Example:
Suppose we want to redirect the domain name www.example.com to www.newexample.com. The following is a specific configuration example.
Domain Names: www.example.com
Scheme: http
Forward Hostname/IP: www.newexample.com
After completing the above configuration, when accessing www.example. com, Nginx will automatically redirect the request to www.newexample.com.
Summary:
This article introduces how to use Nginx Proxy Manager to implement URL redirection and provides specific configuration examples. By using Nginx Proxy Manager, URL redirection can be easily configured and managed. Hope this article can be helpful to you.
The above is the detailed content of Nginx Proxy Manager Configuration Guide for Implementing URL Redirection. For more information, please follow other related articles on the PHP Chinese website!