frpc配置
[名称]
type = http
local_ip = 127.0.0.1
local_port = 88 # frps配置的http端口为88
custom_domains = 子域名.runm.top
修改nginx配置http{}模块中配置:
#frp配置
server {
listen 80;
server_name *.runm.top;
location ~^/ {
proxy_pass http://$host:88;
proxy_set_header Host $host;
proxy_set_header Remoter_addr $remote_addr;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 6 128k;
proxy_busy_buffers_size 256k;
proxy_temp_file_write_size 256k;
}
location ~ .*\.(gif|jpg|png|bmp|swf|css|js)$ {
proxy_pass http://$host:88;
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 1d;
}
}
重启nginx,然后测试在浏览器中输入域名,如果出现502报错:
代表未启用resolver指令指定DNS地址,需要在http{}模块中在添加一行:
resolver 8.8.8.8;
重启nginx。然后重新访问: