
环境:ubuntu + nginx?? + php-fpm??
主要修改nginx 的default 文件
map $http_upgrade $connection_upgrade {
?? ?? default upgrade;
?? ?? '' close;
}
upstream websocket {
?? ?? server :8282;?? //websocket 的8282端口
}
server {
listen?? ?? ?? ??443;
server_name?? ;
ssl on;
ssl_certificate /usr/local/apache/conf/1_; //证书路径

ssl_certificate_key /usr/local/apache/conf/2_;??//证书路径
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_protocols TLSV1.1 TLSV1.2 SSLv2 SSLv3;
ssl_ciphers ALL:!ADH:!EXPORT56:R+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
ssl_prefer_server_ciphers?? on;
root /var/www/html;
index index.php index.html index.htm;
location / {
?? ?? ?? ?? ??try_files $uri $uri/ =404;
}
location /wss{
?? ?? ?? ??proxy_pass ;?? ??# 代理到上面的地址去
?? ?? ?? ??proxy_http_version 1.1;

?? ?? ?? ??proxy_set_header Upgrade $http_upgrade;
?? ?? ?? ??proxy_set_header Connection "Upgrade";
}
location ~ \.php$ {
?? ?? ?? ?? include snippets/fastcgi-php.conf;
?? ?? ?? ?? fastcgi_pass unix:/run/php/php7.0-fpm.sock;
?? ?? }
location ~ /\.ht {
?? ?? ?? ?? ?? ?? ?? ?? deny all;
?? ?? ?? ?? }
}
https?? https://xxx.cn;
websocket?? wss://xxx.cn/wws;
实现了根据路由转发
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-79413-1.html
好想去哎谁让我是个学生党呢凡凡
演技太好了
真想开打就是误国呢