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

Implementing search box function with search icon based on html css

Preface Let me share with you how to make a searc...

Who is a User Experience Designer?

Scary, isn't it! Translation in the picture: ...

Summary of the use of Vue computed properties and listeners

1. Computed properties and listeners 1.1 Computed...

Implementation of Docker private warehouse registry deployment

As more and more Docker images are used, there ne...

Solution to the CSS height collapse problem

1. High degree of collapse In the document flow, ...

Vue implements login type switching

This article example shares the specific code of ...

Detailed explanation of the use of Vue image drag and drop zoom component

The specific usage of the Vue image drag and drop...

CentOS 7.9 installation and configuration process of zabbix5.0.14

Table of contents 1. Basic environment configurat...

404 error occurs when accessing the homepage of tomcat started in Docker mode

Scenario: When starting tomcat in docker (version...

The perfect solution for forgetting the password in mysql8.0.19

Recommended reading: MySQL 8.0.19 supports accoun...

MySQL Learning: Three Paradigms for Beginners

Table of contents 1. Paradigm foundation 1.1 The ...

Learn MySQL execution plan

Table of contents 1. Introduction to the Implemen...

HTML Tutorial: HTML horizontal line segment

<br />This tag can display a horizontal line...