Trying to host simple html site with apache2

I went through the basic tutorials on securing server with no problems. I am a new Linux user so just that was a big accomplishment. I want to host a small and simple html page on my Linode using apache2 but I ran into problems while following the example here:

How to host a website

after Step 8: (sudo systemctl reload apache2) , I get this output:

Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.

Then I ran this command:
$ systemctl status apache2.service

● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.backup.conf, apache2-systemd.conf
Active: failed (Result: exit-code) since Fri 2019-11-15 18:39:45 PST; 14s ago
Process: 1000 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)

What did I do wrong? Should I remove all apache2 packages and apt purge and start over and just use the default /var/www/html location for my site's index.html?

I can get that to work with my domain name, but after following steps in link above I get the error message and still my domain name points to the default apache2 page.

I'm not sure what I messed up

3 Replies

Linode Staff

There's usually a log printout just below the section you copied over for systemctl status apache2.service, could you check to see if it mentions the reason it wasn't able to start? You may also want to check the Apache error log in /var/log/apache2

If you paste the log here, I'll take a look and do my best to point you in the right direction.

Thanks so much for your reply. I actually ended up completely removing apache2 package and files and then reinstalled and instead of following the example from Linode I followed this tutorial: (https://www.youtube.com/watch?v=5Q_KFI0VkH0)

I ended up getting everything working the way I wanted.

OK it turns out I need help still. I have a similar issue and dont know if I should make a new post.

My free domain is "domain.tk" with no (www)
My site.conf file has the following in it:

ServerName domain.tk
ServerAlias www.domain.tk

When I go to the browser and type it with www, I land on my site, but when I remove the www, I am sent to:

The requested URL was not found on this server.
Apache/2.4.41 (Ubuntu) Server at domain.tk Port 80

Before I started over I was sent to the default apache2 page without the www.

I want my page to come up whether the www is there or not. I dont want people landing on Not found showing Ubuntu server at domain.tk.

How do I do this?

Edit Is this because I still have the 000-default.conf site enabled? Because the .conf file is still in the same directory as the one for my site and the directory it points to has no files in it.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct