Apache Can';t使用httpd(CentOS)将虚拟主机绑定到不同的端口

Apache Can';t使用httpd(CentOS)将虚拟主机绑定到不同的端口,apache,.htaccess,redirect,httpd.conf,vhosts,Apache,.htaccess,Redirect,Httpd.conf,Vhosts,我有一个有CentOS和Apache的VDS。我使用的是基于虚拟的主机,所以我有域'my.domain'和少数子域,如'sub1.my.domain','sub2.my.domain'等。每个子域在/etc/httpd/conf/vhosts/中都有自己的配置文件 我需要将所有连接从sub1.my.domain:8080重定向到另一个.web.site:8080。因此,我在sub1.my.domain的根目录下的.htaccess文件中添加了以下行: RewriteEngine On Rewr

我有一个有CentOS和Apache的VDS。我使用的是基于虚拟的主机,所以我有域'my.domain'和少数子域,如'sub1.my.domain','sub2.my.domain'等。每个子域在/etc/httpd/conf/vhosts/中都有自己的配置文件

我需要将所有连接从sub1.my.domain:8080重定向到另一个.web.site:8080。因此,我在sub1.my.domain的根目录下的.htaccess文件中添加了以下行:

RewriteEngine On 
RewriteCond %{SERVER_PORT} 8080
RewriteCond %{REQUEST_URI} ^/
RewriteRule (.*) http://another.web.site:8080
但它无法工作,因为web服务器只侦听端口80。因此,我对/etc/httpd/httpd.conf进行了如下修改:

Listen 80
Listen 8080
并修改了sub1.my.domain的vhost文件。而不是

<VirtualHost myserverip:80>
    ServerName sub1.my.domain
    AddDefaultCharset off
    AssignUserID www-root www-root
    DirectoryIndex index.html
    DocumentRoot /var/www/www-root/data/www/sub1.my.domain
...
</VirtualHost>

ServerName sub1.my.domain
添加默认字符集
AssignUserID www root www root
DirectoryIndex.html
DocumentRoot/var/www/www-root/data/www/sub1.my.domain
...
…现在它的内容

<VirtualHost myserverip:8080>
    ServerName sub1.my.domain
    AddDefaultCharset off
    AssignUserID www-root www-root
    DirectoryIndex index.html
    DocumentRoot /var/www/www-root/data/www/sub1.my.domain
...
</VirtualHost>

ServerName sub1.my.domain
添加默认字符集
AssignUserID www root www root
DirectoryIndex.html
DocumentRoot/var/www/www-root/data/www/sub1.my.domain
...
所以,如中所述,我添加了新端口以在httpd配置中侦听,并设置了新端口以在域的虚拟主机配置中解析。但是当我试图打开sub1.my.domain:8080时,我得到一个错误-浏览器无法解析该地址。我甚至通过iptables转发了8080端口,重新启动了整个服务器,但没有任何帮助


我做错了什么?

花了整整一天的时间来理解fail2ban阻止了所有与8080的连接。我通过iptables将rule添加到fail2ban表中,一切都像一个符咒