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
2
Answers
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>
If you insist on changing it to port 8080, it lives inside the
/usr/sbin/apache2ctl
file. Just edit and search forSTATUSURL=
.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.Make sure port 80 is enabled in
/etc/apache2/ports.conf
. You should see:and/or
and restart server:
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 allowapache2ctl
to work for localhost http calls.