域名:shinyboy.top
web-三国 部署地址:/www/wwwroot/sg , 域名访问地址:https://shinyboy.top/sg
web-typecho 部署
地址:/www/wwwroot/typecho 域名访问地址:https://shinyboy.top/typecho
server接口,假设本机服务器开放端口813 域名访问地址:https://shinyboy.top/api/
微信小程序开发,登入 使用第三方域名转发服务:
server {
#SSL 默认访问端口号为 443
listen 443 ssl;
#请填写绑定证书的域名
server_name shinyboy.top;
#请填写证书文件的相对路径或绝对路径
ssl_certificate www.shinyboy.top_bundle.crt;
#请填写私钥文件的相对路径或绝对路径
ssl_certificate_key www.shinyboy.top.key;
ssl_session_timeout 5m;
#请按照以下协议配置
ssl_protocols TLSv1.2 TLSv1.3;
#请按照以下套件配置,配置加密套件,写法遵循 openssl 标准。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
# 绑定域名根目录访问地址
location / {
root /www/wwwroot/sg2/h5;
index index.html index.htm;
}
location /sg {
alias /www/wwwroot/sg2/h5;
index index.html;
}
location /typecho {
root /www/wwwroot/typecho/; #静态资源路径
index index.html index.htm;
try_files $uri $uri/ /index.html =404;
}
# 转发接口配置 proxy_pass,假设开放端口为813
location ^~/api/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:813/;
error_page 405 =200 http://$host$request_uri;
}
# 微信小程序登录转发 code2Session
location ^~/weixin/api/ {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass https://api.weixin.qq.com/sns/jscode2session ;
error_page 405 =200 http://$host$request_uri;
}
# 配置其他路由,域名/zfy
location /zfy {
alias /www/wwwroot/sg2/h5;
index index.html;
}
}