如何在 443 端口上配置多个进程?阿帕奇 - ubuntu

How configure multiples process on 443 port? Apache - ubuntu

这是我的问题:

我在服务器上配置了 2 个应用程序。 React(客户端)和 nodejs 后端及其各自的域。 1 - example1.com 2 - example2.com

我也为每个配置了两个 SSL 证书。当您想在客户端 运行ning.

所在的同一端口上启动后端时,会出现此问题

可以运行 2个进程吗?我应该怎么做?

这些是我的虚拟主机文件:

示例 1-le.ssl.conf


<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName example1.com
    ServerAlias www.example1.com
    ServerAdmin info@xample.com
    DocumentRoot /var/www/example1
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


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

example1.conf

        ServerName example1.com
        ServerAlias example1.com
        ServerAdmin info@example.com.ar
        DocumentRoot /var/www/example/build

        <Directory "/var/www/example/build">
          RewriteEngine on
         # Don't rewrite files or directories
          RewriteCond %{REQUEST_FILENAME} -f [OR]
          RewriteCond %{REQUEST_FILENAME} -d
          RewriteRule ^ - [L]
           # Rewrite everything else to index.html to allow html5 state links
           RewriteRule ^ index.html [L]
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteCond %{SERVER_NAME} =example1.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

另一个也一样

当我尝试启动第二个项目时,我收到:EADDRINUSE:地址已在使用中:::443

非常感谢你的帮助

您不能将 2 个不同的进程绑定到同一个端口上。 Olaf Kock 的建议工作得很好并且很容易实现:在专用服务器上(或在同一台机器上:没有区别)安装 apache,然后配置反向代理(该模块称为 mod_proxy)。还有其他解决方案(如 haproxy)需要更复杂的配置,但提供更多配置选项。