Jos*_*erk 2 iptables port apache-2.2
我在我的 Web 服务器上托管了两个应用程序,一个是 Drupal 站点,另一个是 Errbit 安装,它是一个 Ruby on Rails 应用程序。这些 URL 看起来像这样:
http://ourcompany.com
http://errbit.ourcompany.com:3000
Run Code Online (Sandbox Code Playgroud)
我想在第二个 URL 上删除 :3000 的需要,因此我们可以通过以下方式直接访问它:
http://errbit.ourcompany.com
Run Code Online (Sandbox Code Playgroud)
我不想重定向,我希望保留 URL,没有端口号。我以前使用以下命令行命令来设置一些 IP 表重新配置:
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 3000
sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 3000
Run Code Online (Sandbox Code Playgroud)
...运行良好,因为旧服务器上没有运行 Apache。但是,这将导致端口 80 上的所有请求都被重定向到端口 3000,这意味着它将中断对http://ourcompany.com 的
我该如何设置?
有没有办法配置 IP 表以允许这样做,或者这会在 Apache2 配置中完成吗?
<VirtualHost *:80>
ServerName errbit.ourcompany.com
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
http://httpd.apache.org/docs/2.0/mod/mod_proxy.html
| 归档时间: |
|
| 查看次数: |
11961 次 |
| 最近记录: |