Detailed explanation of Frp forced redirection to https configuration under Nginx

Detailed explanation of Frp forced redirection to https configuration under Nginx

Because the router at home forced to reduce the bandwidth of 300M to 80M, I bought a 3205U soft router. It did not disappoint me. The speed was so fast O(∩_∩)O Haha~ Of course, since the broadband does not have a public IP, DDNS cannot be used, so I used frp instead. I encountered some pitfalls in the process, so I recorded it and hope it can help students in need.

frps.ini (server configuration)

[common]
bind_port = 5443
kcp_bind_port = 5443

vhost_http_port = 8080
vhost_https_port = 4443

# Frp server indicator panel configuration admin_addr = frp.test.com
dashboard_port = 6443
dashboard_user = test
dashboard_pwd = test

log_file = ./frps.log

# trace, debug, info, warn, error
log_level = info

log_max_days = 3

# auth token can generate some strings independently token = sfsfgsdgsdgsgddgsg

tcp_mux = true

max_pool_count = 50

# User-defined domain name subdomain_host = frp.test.com

frpc.ini (client configuration)

[common]
# Remote server IP address server_addr = 8.8.8.8
server_port = 5443
token = sfsfgsdgsdgsgddgsg
tls_enable = true

[lede]
type = http
local_ip = 10.10.10.1
local_port = 80
# The value here will eventually be resolved to lede.frp.test.com (you need to do a domain name pan-resolution of *.frp.test.com pointing to your own public server in your domain name server)
subdomain = lede
use_encryption = false         
use_compression = true

# HTTP basic authentication can be left blank http_user = test
http_pwd = test

vhosts.conf (Nginx configuration)

server {
 listen 80;
 listen 443 ssl http2;
 ssl_certificate /usr/local/nginx/conf/ssl/lede.frp.test.com.crt;
 ssl_certificate_key /usr/local/nginx/conf/ssl/lede.frp.test.com.key;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
 ssl_prefer_server_ciphers on;
 ssl_session_timeout 10m;
 ssl_session_cache builtin:1000 shared:SSL:10m;
 ssl_buffer_size 1400;
 add_header Strict-Transport-Security max-age=15768000;
 ssl_stapling on;
 ssl_stapling_verify on;
 server_name lede.frp.okuka.com;
 access_log /data/wwwlogs/lede.frp.test.com_nginx.log combined;

 if ($ssl_protocol = "") { return 301 https://$host$request_uri; }

 location / {
      proxy_pass http://127.0.0.1:8080;#The port number must be consistent with vhost_http_port in frps.ini proxy_set_header Host $host;
      proxy_set_header X-Real-IP 8.8.8.8;#Fill in your public server IP here 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Notice! ! ! ! ! The above operations can only be used after restarting the service

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed tutorial on configuring nginx for https encrypted access
  • Alibaba Cloud Nginx configures https to implement domain name access project (graphic tutorial)
  • Detailed explanation of the principle and implementation process of Nginx configuration https
  • Detailed process of configuring Https certificate under Nginx
  • Nginx configures the same domain name to support both http and https access
  • Detailed configuration of Nginx supporting both Http and Https
  • Nginx http health check configuration process analysis
  • How to configure SSL certificate in nginx to implement https service
  • How to install nginx in docker and configure access via https
  • Nginx configuration and compatibility with HTTP implementation code analysis

<<:  Mysql5.6.36 script compilation, installation and initialization tutorial

>>:  A detailed discussion of evaluation strategies in JavaScript

Recommend

centos7.2 offline installation mysql5.7.18.tar.gz

Because of network isolation, MySQL cannot be ins...

How to use html2canvas to convert HTML code into images

Convert code to image using html2canvas is a very...

A brief understanding of the three uses of standard SQL update statements

1. Environment: MySQL-5.0.41-win32 Windows XP Pro...

Solve the problem of invalid utf8 settings in mysql5.6

After the green version of mysql5.6 is decompress...

Service management of source package installation under Linux

Table of contents 1. Startup management of source...

React native ScrollView pull down refresh effect

This article shares the specific code of the pull...

MySQL scheduled database backup operation example

This article describes the example of MySQL sched...

Example of javascript bubble sort

Table of contents 1. What is Bubble Sort 2. Give ...

Div css naming standards css class naming rules (in line with SEO standards)

There are many tasks to be done in search engine o...

Getting Started: A brief introduction to HTML's basic tags and attributes

HTML is made up of tags and attributes, which are...

Detailed explanation of the functions and usage of MySQL common storage engines

This article uses examples to illustrate the func...

Solution to the problem that MySQL commands cannot be entered in Chinese

Find the problem Recently, when I connected to th...