-1

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)

  • There could very well be a problem with your PHP installation, or something else. Since during the upgrade you just blindly hit a key in answer to the prompts, who knows what all may have gotten screwed up. – Scott Severance Mar 02 '16 at 23:29

3 Answers3

1

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.

  • OK I am learning fast

    Here is what I have done so far

    cd /etc/apache2

    Then got the list with the command "ls" here is what it come back with

    apache2.conf conf.d mods-enabled sites-enabled apache2.conf.dpkg-old envvars ports.conf ssl conf-available magic ports.conf.dpkg-old conf-enabled mods-available sites-available

    Then went to /etc/apache2/sites-enabled put "ls" command came back with this

    compliance, intranet scouting surveys default-ssl.conf owncloud submissions test

    Where do I go from here?

    – Dr Foster Mar 01 '16 at 23:51
  • All that configuration is specific to your company. Since your predecessor is no longer available, you're going to have to do some detective work. Look around, read the documentation, compare your findings to whatever you may know of the correct configuration. I really hope you have backups. – Scott Severance Mar 02 '16 at 01:01
  • You can us less to examine the contents of a file. I can't tell you anything more specific because I don't know the configuration specifics for your system. – Scott Severance Mar 02 '16 at 01:03
  • I've updated my answer. See above. – Scott Severance Mar 02 '16 at 01:16
0
  1. sudo service apache2 restart

  2. go to your browser and use 12.0.0.1/"write name of your project folder"

  3. press Enter that worked for me after brainstorming for so long..

0

OK, this is a well known issue when upgrading from Precise. The document root has moved from /var/www to /var/www/html which other distros have been using for a while, particularly RHEL (and derivatives) and Debian.

What was shockingly bad (!) was that do-release-upgrade did not cater for this automatically. The simple solution is to move it back. As above locate the document root line in the config file and change it back to /var/www.

Alternatively move your code down to /var/www/html, and this is where relative paths would serve people well as having absolute paths (for php includes etc.) will require code changes.

I still run Ubuntu servers, but I lean towards CentOS because of this sort of thing.

EDIT 2. (Step by step).

1) On the command line, in a terminal screen or window, open the "nano" editor as root to alter the configuration file that specifies the Document root location.

sudo nano /etc/apache2/sites-available/000-default.conf

Notes : this is a text editor.

2) Locate, after the initial comment block, these lines.

        ServerAdmin webmaster@localhost  
        DocumentRoot /var/www/html  

3) Place "# " in front of the word "DocumentRoot" so that it will be ignored, and so that the change will be more obvious to a later reader.

        ServerAdmin webmaster@localhost  
        # DocumentRoot /var/www/html  

4) Add a new line as shown below. Note /var/www.

        ServerAdmin webmaster@localhost  
        # DocumentRoot /var/www/html  
        DocumentRoot /var/www  

HINT: lines can be cut and duplicated with Ctrl-K, Ctrl-U, Ctrl-U.

5) reboot.

mckenzm
  • 355
  • 2
  • 11
  • OK here is the main issue I don't know how to "code" in linux as I am a network and cabling engineer so how do I do that ? I can navigate to the apache directory but that's about it – Dr Foster Mar 02 '16 at 09:12
  • Forgive me but how do I "fall back" I need step-by-step "hold my hand" instructions – Dr Foster Mar 02 '16 at 10:21
  • OK, if the code is not yours it is likely to cope well with being moved around. I recommend you fall back to /var/www as the document root and not use the html folder. All further installs of anything should honour the document root you specify. I have updated my answer. – mckenzm Mar 02 '16 at 10:30
  • Ok that is no good I need more simple instructions (example step 1 do this by imputing this text step 2 do that by imputing this text and so on and so on). Sorry for being a pain but I'm in over my head :( – Dr Foster Mar 02 '16 at 10:56
  • I have re-edited after a short delay. (time zone related). – mckenzm Mar 02 '16 at 19:12