运行 PHP 和 Node.js 在同一台服务器上的问题

Problem with running PHP and Node.js on same server

我正在尝试在同一台服务器上 运行 Node.js 和 socket.io。我们有一个小工具,允许用户测试他们的 websockets,您可以在 here. Now the problem is that its not connecting with domain for example if ill use the original ip https://123.23.23.12:3001/socket.io/?EIO=3&transport=polling&t=NIHXfZI (disclosing real ip for sake of confidentiality) it connects to the socket.io but when i use https://www.101toolbox.com:3001/socket.io/?EIO=3&transport=polling&t=NIHXfZI 中找到它只是无法连接。现在我尝试创建反向代理和其他东西,但它也没有用,服务器正在使用 laravel 和一些节点 js,它们是 pm2 的 运行,请注意它们在移动网站之前工作到新主机而不使用任何特殊的 apache2 配置。这是 apache2 的配置,我真的没主意了。

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName 101toolbox.com
        ServerAlias www.101toolbox.com *.101toolbox.com 101toolbox.com
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/101toolbox/public
        ErrorLog ${APACHE_LOG_DIR}/101toolbox_error.log
        CustomLog ${APACHE_LOG_DIR}/101toolbox_access.log combined
        <Directory /var/www/101toolbox>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

SSLCertificateFile /etc/letsencrypt/live/101toolbox.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/101toolbox.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>

这是使节点应用程序工作的 apache2 的正确配置。结果我应该为 socket.io.

注册 2 个不同的代理
<IfModule mod_ssl.c>
<VirtualHost *:443>
    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so

    ServerName 101toolbox.com
    ServerAlias www.101toolbox.com *.101toolbox.com 101toolbox.com
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/101toolbox/public
    ErrorLog ${APACHE_LOG_DIR}/101toolbox_error.log
    CustomLog ${APACHE_LOG_DIR}/101toolbox_access.log combined

    <Directory /var/www/101toolbox>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    SSLProxyEngine On
    SSLProxyVerify none
    SSLProxyCheckPeerCN off
    SSLProxyCheckPeerName off
    SSLProxyCheckPeerExpire off 
    ProxyRequests Off 
    ProxyPass /node https://127.0.0.1:3000
    ProxyPassReverse /node https://127.0.0.1:3000

    ProxyPass /sockets https://127.0.0.1:3001
    ProxyPassReverse /sockets https://127.0.0.1:3001
    
    ProxyPreserveHost On
    ProxyPass   /socket.io https://127.0.0.1:3001/socket.io
    ProxyPassReverse /socket.io https://127.0.0.1:3001/socket.io

SSLCertificateFile /etc/letsencrypt/live/101toolbox.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/101toolbox.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>