OpenVPN不与nginx共享端口

我有OpenVPNconfiguration为端口443发送非VPN通信到端口4433上我的nginx服务器。当我去https://domain.tld:4433它的工作,虽然https://domain.tld (在哪里OpenVPN侦听端口443 TCP)导致“页面不可用”(Chrome中的ERR_CONNECTION_CLOSED)。

OpenVPNconfiguration:

port 443 proto tcp port-share localhost 4433 

Nginx的configuration:(实际上并不需要,因为我敢肯定它的工作原理)

 server { listen 1.2.3.4:4433; server_name domain.tld www.domain.tld; ssl on; ssl_certificate /home/rick/conf/web/ssl.domain.tld.pem; ssl_certificate_key /home/rick/conf/web/ssl.domain.tld.key; error_log /var/log/apache2/domains/domain.tld.error.log error; ... } 

这是我解决它的方法:

  1. 检查OpenVPN是否正在侦听端口443 TCP。 根据configuration进行检查,以及端口检查服务。
  2. 将port-share设置为port-share {IP} {PORT}

如何知道{IP}和{PORT}?

在nginx中:

 server { listen {IP}:{PORT}; } 

在Apache中:

 <VirtualHost {IP}:{PORT}> ServerName {IP} ServerAlias {IP} // Could also be an hostname, hostname also work on OpenVPN port-share. // When {IP} in the VirtualHost opening tag is "*", using localhost or // 127.0.0.1 or Public IP in OpenVPN, will fix the problem. </VirtualHost> 

希望这可以帮助你!