Ubuntu – I’m getting this “You should replace this file (located at /var/www/html/index.html)” after update to v14.4 ubuntu

Apache2server

Ok here is what is going on First I updated php on Ubuntu v12 to php v5.5 (then checked sites to make sure they still worked) Then upgraded OS to v14 (trusty)

When was prompted just said "i" to all prompts System did a reboot and from there entered "ls" to make sure files where still there.

But web pages will not show in browser instead I get the "default page" I have tried to redirect the apache to the new file location "located at /var/www/html/index.html" but I don't think I am doing it correctly like I said I'm no good with command line

There is no admin he got canned and will not respond

EDIT 1

OK So I am guessing I now need to get the Apache to point to the html files (instead of the directory of the apache tree where it does now)

What do I need to enter in order for this to happen? How do I get apache to redirect to the apache2.conf.dpkg-old file or copy the contents into apache2.conf ?

Edit 2

Big Problem….!!!!

Now the web page has gone down It now says "This webpage is not available"

The web page is the main source of income and I may well lose my job if I don't "fix" this so I will need a step-by-step on how to change:

1.The document root that has moved from /var/www to /var/www/htm

Or

  1. Move the code down to /var/www/html

EDIT 3

OK so after editing text file using: sudo nano /etc/apache2/sites-available/000-default.conf

I tried to "restart" apache I get this: * The apache2 configtest failed. Output of config test was: AH00526: Syntax error on line 1 of /etc/apache2/apache2.conf: Invalid command 'bash:', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. The Apache error log may have more information. What does this mean? How do I fix it?

EDIT 4

Got the apache working again

However now when I try to navigate to host page in web browser I am greeted with the root table I can navigate to html/ file but am greeted with the "404 not found page" on 3 of the webpages and the "default apache ubuntu" page on the other one.

1 How do I fix?
2 What are the steps to do this?

EDIT 5

Managed to figure that sites needed to be reregistered and new certs given to upload them (they are all joomla sites)

Could it be that the php is not doing what it is meant to?
If so do I just update it (PHP will need to be 5.6 as higher will not work with where sites are hosted)

Best Answer

Apache configuration files live in /etc/apache2. You can use the cd command to change to the appropriate directory:

cd /etc/apache2

There are several ways to edit configuration files. The easiest to learn is nano. You'll also probably need to use sudo to edit Apache's configuration. Thus:

sudo nano apache2.conf

You need to change Apache's DocumentRoot directive (or VirtualDocumentRoot). Which file it is in depends on your specific configuration. I'd recommend looking first in /etc/apache2/apache2.conf as well as whatever may be in /etc/apache2/sites-enabled.

If you search the Apache website for DocumentRoot, you'll find a lot of useful documentation. In general, Apache's documentation is quite good.

After you make changes to the configuration, you'll have to restart Apache for them to take effect:

sudo service apache2 restart

EDIT

I just realized something important: Since when you upgraded you blindly answered each question without finding out what you were doing first, it's highly likely that you hosed your Apache configuration, and there are probably quite a few things wrong beyond this one issue. (You may have also hosed the configuration of other software on the machine, as well.) I'd recommend that you get /etc/apache2 from backup and carefully compare the two versions to decide how to reconstruct your configuration. If you don't have backup, then you'll have a lot of fun!

One key difference between Linux and Windows: Windows installers ask lots of pointless questions, leading to the "next, next, next" phenomenon. But Linux tends not to ask pointless questions. So if it asks a question, be careful how you answer it, because it is probably important.

EDIT 2

Wait a second. The files ending in .dpkg-old are the versions of the files pre upgrade. They should contain the correct configuration. You can probably compare them with the non-suffixed files to discover the correct configuration.

Use the diff command to see the differences between two files. Use nano to edit a file, and cp to make a copy of a file (or a backup in case something goes wrong). mv will move or rename a file, and rm will permanently delete a file without confirmation and without a recycle bin. So be careful. To learn how to use a command, use man: e.g., man diff.

Related Question