AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-1642566

Dean Debrio's questions

Martin Hope
Dean Debrio
Asked: 2023-11-27 15:34:14 +0800 CST

为什么我在使用 nginx 时看到 Apache2 默认页面

  • 6

这是我第一次使用 Ubuntu 设置虚拟服务器,我对 Apache2 有一些疑问。

当我打开虚拟服务器时,它以lightppd. 因为(我认为)我过去使用 XAMPP 界面更熟悉 Apache 设置,所以我卸载了它并安装了 Apache。现在已经使用 Apache2 两周了,我的网站(连接到上述 VPS)不断显示 Apache 成功设置页面。我已经尝试了 Ubuntu stackExchange 和其他论坛中的所有解决方案,但结果仍然保持不变。所以从今天开始,我卸载了 Apache 并尝试使用其他服务器(例如 NGINX)。

但是在我卸载它之后,该页面仍然存在,就好像我对它所做的任何事情都不起作用一样。我重新启动了我的 VPS,重新启动了系统,删除了与 Apache 相关的所有内容,但该页面仍然显示在我的网站中。有谁知道我该怎么办以及在哪里寻找问题的根源?

Ubuntu版本是22.04.3 LTS,

Apache 正在工作页面: 在此输入图像描述

netstat -tulp不显示任何 Apache 服务: 在此输入图像描述

我看过这个帮助页面 Cannot shutdown apache2 on 16.04 LTS但 Apache isworking 页面仍然存在。感谢您的帮助。

删除 apache 似乎还应该包括/var/www目录,但由于我也有 nginx,看起来我们可以同时拥有一个/var/www目录

在该/var/www目录中,我看到两个文件夹:一个是命名文件html夹,另一个是我自己的个人网站目录,假设它是myOwnBlog.com. 目录中/var/www/html有两个文件,分别名为test.html和index.nginx-debian.html

html
|-- index.nginx-debian.html
`-- test.html

我们可以忽略/var/www/myOwnBlog.com它,因为它是空的。即使我在此处添加内容,该内容也不会出现,而是显示 Apache 成功消息。

sudo service apache2 status显示:

sudo service apache2 status
Unit apache2.service could not be found.

所以可以验证apache2已经完全卸载了。

sudo service nginx status显示:

nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en>
     Active: active (running) since Tue 2023-11-28 13:25:43 UTC; 1h 15min ago
       Docs: man:nginx(8)
    Process: 419 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process o>
    Process: 519 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=>
   Main PID: 538 (nginx)
      Tasks: 3 (limit: 9553)
     Memory: 10.6M
        CPU: 114ms
     CGroup: /system.slice/nginx.service
             ├─538 "nginx: master process /usr/sbin/nginx -g daemon on; master_pro>
             ├─539 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" >
             └─540 "nginx: worker process" "" "" "" "" "" "" "" "" "" "" "" "" "" >

可以验证nginx确实还在运行。

编辑 1: 添加 sotirov 要求的详细信息:

目录中有一个sites-available /etc/nginx/,内容确实符合要求:

tree sites-available
sites-available
`-- default

index.nginx-debian.html正如预期的那样,其内容是一个欢迎页面,内容nginx为“Welcome to Nginx!” 等等。

这是内容,我认为它应该出现,而不是 Apache 成功页面:

  GNU nano 6.2               index.nginx-debian.html                         <!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
    }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>

<p><em>Thank you for using nginx.</em></p>
</body>
</html>

编辑 2: 尝试有关删除 Apache 的过时方法的 sotirov 提示,

我无法粘贴结果,因为 ssh 一段时间后重新启动了它的会话。但它找到了这些软件包并推荐我sudo apt autoremove:

The following packages will be REMOVED:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap
0 upgraded, 0 newly installed, 7 to remove and 91 not upgraded.
After this operation, 7,160 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 101786 files and directories currently installed.)
Removing apache2-bin (2.4.52-1ubuntu4.6) ...
Removing apache2-data (2.4.52-1ubuntu4.6) ...
Removing apache2-utils (2.4.52-1ubuntu4.6) ...
Removing libaprutil1-dbd-sqlite3:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libaprutil1-ldap:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libaprutil1:amd64 (1.6.1-5ubuntu4.22.04.2) ...
Removing libapr1:amd64 (1.7.0-8ubuntu0.22.04.1) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.4) ...
apache2
  • 1 个回答
  • 145 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve