I'm very much new to hosting my own server. I'm following this tutorial: https://www.answertopia.com/ubuntu/setting-up-an-ubuntu-web-server/ and I've gotten to the section titled "1.7 Configuring the Apache Web Server for Your Domain". I've followed all the steps but when I get to the part where I test the configuration it throws an error because it can't use ip 127.0.1.1. I cleared the error by adding ServerName 127.0.0.1
to /etc/apache2/apache2.conf but when I go to the domain name, the webpage still doesn't show up, and if I go to the ip address, only the default page shows. I'm assuming that the ServerName
command in apache2.conf is the cause of my troubles but maybe there's something else there?
if it helps, I purchased my domain name through google domains.
Edit: I am using ubuntu server 23.04
Here is the content of /etc/apache/sites-available/diyserv.net.conf
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.diyserv.net
ServerAdmin [email protected]
DocumentRoot /var/www/diyserv.net
# 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>
Edit: I edited my router settings and set up port forwarding, and I added A records to google domains, and now I can access the webpage from devices on the same network at www.diyserv.net, but not from devices on a different network. Hopefully this is just a case of needing to wait for DNS records to propogate