Apache连接到端口8080时出现问题

57hvy0tb  于 2022-11-16  发布在  Apache
关注(0)|答案(2)|浏览(271)

我已经设置了我的apache conf文件,按照下面的说明:
https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7
我正在运行RHEL 7。
我又道:

IncludeOptional sites-enabled/*.conf

我的站点启用文件夹有一个fusio.conf文件,如下所示:

<VirtualHost *:8080>
    ServerName server.company.net
    DocumentRoot /var/www/html/fusio/public

    <Directory /var/www/html/fusio/public>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

        # rewrite
        RewriteEngine On
        RewriteBase /

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule (.*) /index.php/$1 [L]

        RewriteCond %{HTTP:Authorization} ^(.*)
        RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
    </Directory>

    # log
    LogLevel warn
    # ErrorLog ${APACHE_LOG_DIR}/fusio.error.log
    # CustomLog ${APACHE_LOG_DIR}/fusio.access.log combined
</VirtualHost>
~

但是,当我连接到server.mycompany.net:8080时,我没有得到响应。
我可以直接连接到server.mycompany.net并查看fusio文件夹中的文件,但我遗漏了什么?
我已将Listed 8080添加到conf文件中。

dz6r00yl

dz6r00yl1#

您可能尚未打开防火墙上的端口(可能是iptablesfirewalld)。
从服务器本身执行以下操作:

$ curl --header "Host: server.company.net" http://127.0.0.1:8080/

如果你得到一个响应,这意味着apache正在运行,但你的防火墙到互联网是不允许它通过端口8080。

防火墙

检查是否正在运行firewalld

# firewall-cmd --state

如果响应为running,我们将其相加

# firewall-cmd --permanent --zone=public --add-port=8080/tcp
# firewall-cmd --reload

个iptables

检查您是否正在使用iptables(iptables是内核修改,因此没有正在运行的“服务”。如果显示规则,则它们已启用。)

# iptables -L

如果您看到规则,则让我们添加另一个。

# iptables -A INPUT -p tcp --dport 8080 -j ACCEPT
wh6knrhe

wh6knrhe2#

检查/etc/apache 2/ports. conf。您需要在此处指定端口。
听80听8080......

相关问题