"404 Not Found" After installation via root

My domain is: clsindustriesllc.com

My hosting provider is: digitalocean.com

I can login to a root shell on my machine: Yes

I’m using a control panel to manage my site: No

I followed the instructions here:

The last command I typed in was at this part

./letsencrypt-auto --apache -d clsindustriesllc.com

And the result I got from my terminal/console was:

So, seems to have been installed correctly… however, when I try to go to any page on my site, it now results in a “404 Not Found”

PLEASE HELP!!
I just finished my site, and forgot to create a backup.

How do I get my site back?
I just want to add SSL and secure my site.

What’s your virtual host list?

apachectl -t -D DUMP_VHOSTS

There are backups of your Apache configuration in /var/lib/letsencrypt, but this should be relatively simple to solve without resorting to backups.

when I run that command, it results in this:

Also, now when I try to access the site, the site can’t be reached…

:confused:

Could you please post the contents of /etc/apache2/sites-enabled/000-default.conf?

It looks like you may have done something like this, which is not valid:

ServerName $server_name

Also, are you using anything like ServerPilot or Bitnami?

No on the ServerPilot or Bitnami.

Also, I don’t exactly follow on that last command.

Please excuse my limited command line knowldege

Okay.

To view the contents of that file, you can run this:

cat /etc/apache2/sites-enabled/000-default.conf

03

^^^ This is what was retunred after I run that ‘cat’ command

Thanks.

That configuration file is quite broken and is causing your webserver to not work. I’m really puzzled as to how the apachectl command ended up inside that file.

Are you comfortable enough with the command line to edit that file? It’s salvageable, you need to make these changes:

  • Replace the ServerName line with ServerName clsindustriesllc.com
  • Remove the ServerAlias line
  • Remove the second and third RewriteCond lines

I do understand when I’m in the screen to edit files, but I’m not entirely sure what file we’re referring to.

What’s the exact command so I can edit the file?

I can do that part.

Thank you very much for your patients.

— Update

Okay. nano /etc/apache2/sites-enabled/000-default.conf

I am updating now

Updated the file:

Great. Now you can try restart Apache:

service apache2 restart

Which should allow you to reach your webserver again.

Once again, try to run the apachectl -t -D DUMP_VHOSTS command, making sure you are not in nano or any other text editor, or running Certbot when you do it. I just want to see what it says.

Awesome. Am able to reach the web sever again. Now it’s back to showing the 404 Not Found screen.

Here’s the results after running that last command.

First is a question: what directory/folder did you put your WordPress website in?

Secondly, please provide the output of the other config file:

cat /etc/apache2/sites-enabled/000-default-le-ssl.conf

I can’t say what folder. I just created a Wordpress website through my host’s standard process.
I use Digital Ocean.

Here’s the results I got with that last command:

Also, when I run the ‘dir’ command on root:

59

Well, we need to know this piece of information.

This might help you locate it. It will take a while to run:

find / -name wp-config.php 2>/dev/null
1 Like

It’s been found. :j

48

Right.

So here’s the situation right now:

  • Your WordPress installation is actually located in /var/www/html.old/html
  • Your webserver thinks it’s in /var/www/html

The result is that your webserver is looking in a non-existent location, so you get the 404 error.

Why are you in this situation? Who knows. Maybe it’s your own doing, or maybe the DigitalOcean WordPress installer broke somehow.

The simple fix would be to edit the /etc/apache2/sites-enabled/000-default-le-ssl.conf file so that the configured DocumentRoot option points to the true WordPress location, but I don’t know if it’s the right fix, because I lack the context to understand how you got here in the first place.

In any case, your Let’s Encrypt SSL certificate is setup just fine, it’s WordPress that’s you’re having trouble with.

I follow.

Can I just create a folder in the ‘/var/www’ directory named ‘html’
and copy the wp-config.php to that folder?

Then I can delete the ‘html.old’ folder?

I really don’t know how that happened either.

I will give your suggestion a try.

I believe, this is what we can do so I can at least get my site back online for the time being?

No, that'll delete your whole WordPress website.

1 Like