FRP, or Fast Reverse Proxy, is a powerful tool that allows you to expose local services on your VPS (Virtual Private Server) to the internet. It provides a secure way to access your applications remotely. In this article, we will guide you on how to configure FRP to use full HTTPS with Nginx.
Step 1: Install and Configure Nginx
The first step is to install Nginx on your VPS. Nginx is a popular web server that will act as a reverse proxy for FRP.
To install Nginx, open your terminal and run the following commands:
sudo apt updatesudo apt install nginx
Once Nginx is installed, you need to configure it to listen on port 80 and 443. Open the Nginx configuration file by running:
sudo nano /etc/nginx/sites-available/default
Inside the file, find the server block and update it as follows:
server {
listen 80;
listen [::]:80;
server_name your_domain.com;
location / {
proxy_pass http://localhost:7000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
Save and close the file by pressing Ctrl + X, then Y, and finally Enter.
Restart Nginx to apply the changes:
sudo service nginx restart
Step 2: Generate SSL Certificates
To enable HTTPS, you need to generate SSL certificates. We will use Let's Encrypt, a free and open certificate authority.
First, install the Certbot tool by running:
sudo apt install certbot
Next, generate the SSL certificates by running the following command:
sudo certbot certonly --standalone -d your_domain.com
Replace your_domain.com with your actual domain name.
Once the certificates are generated, Certbot will store them in /etc/letsencrypt/live/your_domain.com/.
Step 3: Configure FRP
Now it's time to configure FRP to use HTTPS with Nginx.
Open the FRP configuration file by running:
sudo nano /etc/frp/frps.ini
Inside the file, find the [common] section and add the following lines:
[common]
...
dashboard_domain = your_domain.com
dashboard_port = 7500
dashboard_user = your_username
dashboard_pwd = your_password
subdomain_host = your_domain.com
vhost_http_port = 80
vhost_https_port = 443
Replace your_domain.com with your actual domain name, your_username with your desired dashboard username, and your_password with your desired dashboard password.
Save and close the file.
Step 4: Start FRP and Access the Dashboard
Start FRP by running the following command:
sudo systemctl start frps
Now you can access the FRP dashboard by visiting https://your_domain.com:7500 in your web browser. Authenticate using the username and password you set in the FRP configuration file.
That's it! You have successfully configured FRP to use full HTTPS with Nginx. Now you can securely access your local services remotely.
References
| Website | Link |
|---|---|
| Nginx | https://nginx.org/ |
| Certbot | https://certbot.eff.org/ |
| FRP | https://github.com/fatedier/frp |