1

我在更改 Apache2 监听的默认端口方面有所尝试,但它不起作用。

我编辑了我的 ports.conf 文件,如下所示:

# Edited:

NameVirtualHost *:9000
Listen 9000

# Kept the same:

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

然后调整我的 VHost 文件(并将其符号链接到启用站点):

<VirtualHost *:9000>

    ServerAdmin webmaster@mysite.co.uk
    ServerName www.mysite.co.uk
    ServerAlias mysite.co.uk

    # Directory Root
    DocumentRoot /home/mysite/www

    # Logfiles
    ErrorLog /home/mysite/log/error.log
    CustomLog /home/mysite/log/www.log "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""

</VirtualHost>

作为记录,如果我将所有端口引用 (9000) 替换为 80,该站点将再次运行。

DocumentRoot 是一个 WordPress 站点。WordPress有可能重写端口号吗?

4

1 回答 1

0

好的。

我的问题末尾的那一点让我开始搜索 WordPress 的障碍,我几乎在前 2 分钟就找到了答案。我会为其他有同样问题的人提供我的修复...

似乎 WordPress 的端口号有点古怪,如果 WordPress 地址或站点地址设置与您尝试访问它的端口不相符,它会尝试删除它们。

转到 WordPress 管理面板中的设置->常规,然后将端口添加:9000到您的WordPress Address (URL)Site Address (URL)值。

请记住在通过 Apache 更改端口之前执行此操作,否则您必须将其更改回来才能更新 WordPress 设置。请注意,当您将 Apache 重新配置到正确的端口时,您的 WordPress 会变得异常活跃。

于 2013-07-24T15:21:34.777 回答