【问题标题】:How to redirect requests coming in port 80 of aws ec2 instance(windows server 2012 R2) to port 8085 for apache?如何将来自aws ec2实例(windows server 2012 R2)端口80的请求重定向到apache的8085端口?
【发布时间】:2019-12-05 04:59:15
【问题描述】:
我有一个带有 Windows server 2012 的 aws ec2 实例,我正在运行一个用于 PHP Web 服务的 wamp 服务器。我想将来自端口 80 的所有请求重定向到 8085,因为我已将 apache 服务器端口从 80 更改为 8085。我们如何将来自端口 80 的请求重定向到 8085?谁能帮我解决这个问题?
【问题讨论】:
标签:
apache
redirect
amazon-ec2
port
wampserver
【解决方案1】:
只需在 Apache 配置文件 /etc/httpd/conf 中进行如下更改
<VirtualHost _default_:80>
DocumentRoot /var/www/html/
RewriteEngine On
RewriteRule ^.*$ http://%{HTTP_HOST}:8085%{REQUEST_URI}
</VirtualHost>
在此之后只需重新启动您的 Apache 服务器。
service apache2 restart