Ubuntu中的Apache Web服务器状态

发布于 2025-02-05 20:49:27 字数 416 浏览 2 评论 0原文

我已经在Ubuntu机器中安装了Apache Web服务器,并将端口更改为8080(/etc/apache2/apache2.conf,/etc/apache2/000-default.conf),并能够

使用以下命令在浏览器中成功加载测试页面(也安装了W3M):

sudo apache2ctl start
sudo apache2ctl stop
sudo apache2ctl status

但是,sudo apache2ctl状态在以下错误:

w3m: Can't load http://localhost:80/server-status

我猜Apache2ctl状态正在拾取默认端口而不是8080。任何人都可以指导在哪里更改该

I have installed apache webserver in my Ubuntu machine and changed port to 8080 (/etc/apache2/apache2.conf, /etc/apache2/000-default.conf) and able to successfully load test page in browser

Using below commands for administration (installed w3m as well):

sudo apache2ctl start
sudo apache2ctl stop
sudo apache2ctl status

However, sudo apache2ctl status is giving below error:

w3m: Can't load http://localhost:80/server-status

I guess apache2ctl status is picking up default port instead of 8080. Can anyone please guide where to change that

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最初的梦 2025-02-12 20:49:28

您尚未提及您在apache2.conf file和000-default.conf中更改了什么。
您需要在apache2.conf中设置listing 8080的值,如果您定义了虚拟主机,则需要将打开的虚拟代码标签设置为< virtualHost *:8080>

You have not mentioned what did you change in apache2.conf file and 000-default.conf.
you need to set the value of Listen 8080 in apache2.conf and if you have defined virtual host you need to set the opening virtual-code tag as <VirtualHost *:8080>

情绪少女 2025-02-12 20:49:28

如果您坚持将其更改为端口8080,则它生活在/usr/sbin/apache2ctl文件中。只需编辑并搜索statusurl =

不过,您是否使用端口8080的原因?

在您的/etc/sites-enabled/000-default.conf(希望您已启用它)中,添加以下行上面的 &lt; virtialhost *:在顶部附近的80&gt;线。这将仅为Local-Host创建一个覆盖/短路。

<VirtualHost localhost:80>  #(or use 8080)
  DocumentRoot /var/www/html
</VirtualHost>

确保在/etc/apache2/ports.conf中启用端口80。您应该查看:

Listen 80

和/或

Listen 8080

重新启动服务器:

sudo systemctl restart apache2.service

然后尝试:sudo apache2ctl status再次..

如果您在VirtualHost内部有一个重定向for&lt;*:80&gt; (我将所有内容都重定向到端口:443/ssl),上面的添加行将拾取Localhost VirtualHost(第一个)AMD允许使用http:// localhost/code> type urls当然也允许哪个允许apache2ctl用于Localhost HTTP调用。

If you insist on changing it to port 8080, it lives inside the /usr/sbin/apache2ctl file. Just edit and search for STATUSURL=.

Is there a reason you are using port 8080, though?

In your /etc/sites-enabled/000-default.conf (hopefully you have it enabled), add the following lines above the <VirtualHost *:80> line near the top. This will create an override/short-circuit for localhost ONLY.

<VirtualHost localhost:80>  #(or use 8080)
  DocumentRoot /var/www/html
</VirtualHost>

Make sure port 80 is enabled in /etc/apache2/ports.conf. You should see:

Listen 80

and/or

Listen 8080

and restart server:

sudo systemctl restart apache2.service

then try: sudo apache2ctl status again..

This also works if you have a redirect inside VirtualHost for <*:80> (mine redirects everything to port :443/SSL), the added lines above will pickup the localhost VirtualHost (first) amd allow the use of http://localhost/ type urls which of course will also allow apache2ctl to work for localhost http calls.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文