• 欢迎访问duantianhen的网站,主要总结PHP、Go、服务器、前端、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站

LNMP下配置小程序https与wsss

Linux admin 12个月前 (03-29) 159次浏览 未收录 0个评论

直接贴nginx配置:

upstream websocket {
server 127.0.0.1:7272 weight=1;#填写socket的服务端口
}
upstream web{
server xxx.xxx.com;# 远程http接口
}
server {
listen 80;
listen 443 ssl;
ssl on;
server_name xxx.xxx.com;
index index.php index.html index.htm;
root /home/wwwroot/xxx;#网站目录
#include enable-php.conf;
include enable-php-pathinfo.conf;#开启pathinfo配置

#此为https配置信息
ssl_certificate /证书路径+名称.pem;
ssl_certificate_key /证书路径+名称.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

#https协议转发 小程序里面要访问的链接(即,把htts://xxx.xxx.com/wss作为wss地址放入小程序内进行调用)
location /wss {
proxy_pass https://xxx.xxx.com:7272;#此处我用的的GateWay自定义的端口,修改成你的socket端口即可
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_set_header X-Real-IP $remote_addr;
}

#配置访问信息
location ~ \.php {
root /home/wwwroot/xxx;#网站目录
fastcgi_pass 127.0.0.1:9000;#调用PHP
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
access_log /home/wwwlogs/accessxcx.log;#记录的访问日志
}


本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:LNMP下配置小程序https与wsss
喜欢 (0)

您必须 登录 才能发表评论!