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

About the configuration problem of MyBatis connecting to MySql8.0 version

When learning mybatis, I encountered an error, th...

Quickly solve the problem that the mysql57 service suddenly disappeared

one, G:\MySQL\MySQL Server 5.7\bin> mysqld --i...

Example code for implementing anti-shake in Vue

Anti-shake: Prevent repeated clicks from triggeri...

Example of how to install kong gateway in docker

1. Create a Docker network docker network create ...

Detailed explanation of the use of state in React's three major attributes

Table of contents Class Component Functional Comp...

Detailed explanation of Strict mode in JavaScript

Table of contents Introduction Using Strict mode ...

JavaScript to show and hide the drop-down menu

This article shares the specific code for JavaScr...

Solve the problem of mysql data loss when docker restarts redis

Official documentation: So mysql should be starte...

XHTML 1.0 Reference

Arrange by functionNN : Indicates which earlier ve...

Node implements search box for fuzzy query

This article example shares the specific code for...

Analyze Mysql transactions and data consistency processing issues

This article analyzes the consistency processing ...

MySQL 5.7.18 Archive compressed version installation tutorial

This article shares the specific method of instal...