Apache链接子网站到网站和游戏服务器

您好我想连接我的子域名,如mc.mywebsite.co.uk我的游戏服务器和网站

我设法使用虚拟主机代理通道将其链接到我的游戏服务器

/etc/apache2/sites-enabled/mc.mywebsite.co.uk.conf

<VirtualHost *:80> ServerAdmin [email protected] ServerName mc.mywebsite.co.uk ServerAlias mc.mywebsite.co.uk ProxyRequests Off #ProxyPass / http://localhost:25565/ <Location /> ProxyPreserveHost On ProxyPass http://mywebsite.co.uk:25565/ ProxyPassReverse http://mywebsite.co.uk:25565/ </Location> # Uncomment the line below if your site uses SSL. #SSLProxyEngine On 

在这种情况下,我可以通过mc.mywebsite.co.uk连接到游戏服务器

但是,当我inputmc.mywebsite.co.uk到我的网页浏览器,我得到以下错误

 Proxy Error The proxy server received an invalid response from an upstream server. The proxy server could not handle the request GET /. Reason: Error reading from remote server Apache/2.4.18 (Ubuntu) Server at mc.mywebsite.co.uk Port 80 

如果我错过了任何东西,我还是很新的。 你们知道我在做什么错吗?

谢谢。

可能发生的情况是,你正在给mc.mywebsite.co.uk的urlmc.mywebsite.co.uk ,DNSparsing到YOUR_IP_ADDRESS:80 ,所以它通过端口80连接到YOUR_IP_ADDRESS:80服务器,通过端口80,通过Apache连接(或更可能它只是告诉请求去哪里)到http://localhost:25565/ 。 你不应该通过Apache路由请求,除非你托pipe多个网站,只需在你的防火墙上打开端口25565,并通过mc.mywebsite.co.uk:25565连接到服务器,DNS将parsing为YOUR_IP_ADDRESS:25565这是你的工艺服务器的正确位置。 任何试图访问你的网站的人都将通过浏览器来实现,浏览器将以80端口为目标(如果是ssl则为443),并通过apache连接,这将是你站点的主机。

https://httpd.apache.org/docs/current/vhosts/examples.html

或者像这样做,我猜

 # Ensure that Apache listens on port 80 Listen 80 Listen 420 <VirtualHost *:80> DocumentRoot "/www/html" ServerName mc.mywebsite.co.uk # Other directives here </VirtualHost> <VirtualHost *:420> ServerAdmin [email protected] ServerName mc.mywebsite.co.uk ServerAlias mc.mywebsite.co.uk ProxyRequests Off #ProxyPass / http://localhost:25565/ <Location /> ProxyPreserveHost On ProxyPass http://mywebsite.co.uk:420/ ProxyPassReverse http://mywebsite.co.uk:420/ </Location> </VirtualHost> 

但你有没有看到我的意思? 它只是接受端口420上的连接并将其发送到端口25565。

通过mc.mywebsite.co.uk:420连接到我的世界,并连接到网站mc.mywebsite.co.uk