从 nginx 切换到 apache,apache 使用 nginx 错误页面

从 nginx 切换到 apache,apache 使用 nginx 错误页面

我从nginx 1.18.0阿帕奇 2.4.41并且 apache 仍在使用 nginx 默认错误页面。我用 删除了 nginx sudo apt-get remove nginx。我正在使用 ubuntu 20.04。

编辑:站点启用的内容

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

答案1

删除 nginx 将删除二进制文件、配置和文档,但不会删除根(web)目录中的文件。

据我所知,Apache 可能使用相同的默认路径作为根目录。所以我会检查 /var/www/website.com(我相信这是 Ubuntu 上 nginx 的默认路径)。

您还需要修复权限,因为您很可能在安装 nginx 时更改了它们。执行ls -alRon /var/www - 修复它们,以便它们符合 Apache 的需求。您可以参考此线程这里

相关内容