Javascript 3000端口上带有https的Node.js socket.io
我想在https上运行node.js和socket.io。我将来自server.example.com的请求重定向到Javascript 3000端口上带有https的Node.js socket.io,javascript,node.js,ssl,https,socket.io,Javascript,Node.js,Ssl,Https,Socket.io,我想在https上运行node.js和socket.io。我将来自server.example.com的请求重定向到 ProxyPass/http://example.com:3000/ 这样我就可以访问socket.io.js文件 要测试node.js部件,请在控制台中打印socket.id 图片: 这是客户端,我用这种方式连接到socket.io 图片: 客户端连接node.js服务器并打印socket.id。但是浏览器控制台中出现了很多错误。我认为客户端希望再次连接,因为出现错误 I
ProxyPass/http://example.com:3000/
这样我就可以访问socket.io.js文件
要测试node.js部件,请在控制台中打印socket.id
图片:
这是客户端,我用这种方式连接到socket.io
图片:
客户端连接node.js服务器并打印socket.id
。但是浏览器控制台中出现了很多错误。我认为客户端希望再次连接,因为出现错误
Image:您必须按如下方式更改apache配置
<VirtualHost *:443>
ServerName mysite.com
ServerAlias www.mysite.com
SSLEngine on
SSLProxyEngine On
ProxyRequests Off
SSLCertificateFile /etc/apache2/ssl/mysite.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/mysite.com.key
SSLCertificateChainFile /etc/apache2/ssl/ca.cer
DocumentRoot /var/www/errorPages
ErrorDocument 503 /503.html
ProxyPass /503.html !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:3000%{REQUEST_URI} [P]
</VirtualHost>
服务器名mysite.com
ServerAlias www.mysite.com
斯伦金安
SSLProxyEngine打开
代理请求关闭
SSLCertificateFile/etc/apache2/ssl/mysite.com.crt
SSLCertificateKeyFile/etc/apache2/ssl/mysite.com.key
SSLCertificateChainFile/etc/apache2/ssl/ca.cer
DocumentRoot/var/www/errorPages
错误文档503/503.html
ProxyPass/503.html!
ProxyPass/http://localhost:3000/
ProxyPassReverse/http://localhost:3000/
重新启动发动机
RewriteCond%{HTTP:UPGRADE}^WebSocket$[NC]
RewriteCond%{HTTP:CONNECTION}^升级$[NC]
重写规则。*ws://localhost:3000%{REQUEST_URI}[P]
<VirtualHost *:443>
ServerName mysite.com
ServerAlias www.mysite.com
SSLEngine on
SSLProxyEngine On
ProxyRequests Off
SSLCertificateFile /etc/apache2/ssl/mysite.com.crt
SSLCertificateKeyFile /etc/apache2/ssl/mysite.com.key
SSLCertificateChainFile /etc/apache2/ssl/ca.cer
DocumentRoot /var/www/errorPages
ErrorDocument 503 /503.html
ProxyPass /503.html !
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
RewriteEngine on
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://localhost:3000%{REQUEST_URI} [P]
</VirtualHost>