Nginx under Frp force redirection for https configuration details

  • 2020-05-17 07:36:33
  • OfStack

Under home routing will be forced to M 80 300 M bandwidth speed, so start with 1 3205 U soft routing, if not disappointing, speed flying O (studying studying) O haha ~ of course, as there is no public broadband IP so DDNS cannot use, switch to frp, in the process of STH over and over again stepped on 1 pit, so, hope I 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 The server indicates the 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  Autonomously generated 1 Some of the string 
token = sfsfgsdgsdgsgddgsg

tcp_mux = true

max_pool_count = 50

#  The user customizes the 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( Need to do in your domain name server to point to your own public network server *.frp.test.com the 
#  Domain name general resolution )
subdomain = lede
use_encryption = false         
use_compression = true

# HTTP Basic certification may not be filled out 
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 1 Need to and frps.ini the vhost_http_port1 to  
      proxy_set_header Host $host;
      proxy_set_header X-Real-IP 8.8.8.8;# Fill in your public network server here IP 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Attention!! This allows you to restart the service before using it


Related articles: