Development webserver - changing localhost to site name

(edit: Im on Ubuntu 20.04)

My virtual host file is

<VirtualHost *:80>
ServerName development
ServerAlias development
DocumentRoot /home/wade/www

Ok… nothing wrong with this.

But today I needed to test from my phone and I need that available as localhost. I read the docs and had to edit 000-default. So I did -> no change. Changed my hosts file to put development first, no change. Checked sites-enabled and the changes are showing up but, still no change. When I type localhost in the browser Im still getting “Welcome to Apache!” I cant figure out how its getting that since I deleted all that from the files.

I don’t know either but I do know Apache has a fault where it backs up everything until you run out of memory and disc space. The other problem is, I can’t remember how I fixed mine

Don’t just delete around stuff, if you do not know what you are doing. This leads to situations like this one.

If you wouldn’t have deleted around stuff, I would’ve suggested, that you turn off the current virtual hosts file, created an identical one, except with localhost pointing to the server. However, since you deleted stuff around, you should restore all configuration from a backup first, before trying out any actual solutions.

What could also be the case: the XY Problem.
That’s why I ask:
Why do you need to change it to localhost?

Ive never experienced this problem nor heard of it and thankfully it has nothing to do with this :slight_smile:

Localhost points to var/www/html and all my files are elsewhere

I was talking about this. Now it’s hard to retrace what is deleted and what is not. This also means, new issues could appear because of these deletions.

Could you post all related configuration to this setup?

This was deleted:

<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.

    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

This was pasted:
<VirtualHost *:80>
ServerName development
ServerAlias development
DocumentRoot /home/development/www

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

hosts file localhost development