I need "/ var / www", but Apache2 is trying to use the empty "/ var / www / html",

These days, I sleep with http://localhost and read pages from /var/www ...

I woke up with the error "AH00094" in the Apache2 log and (created by Apache2?) Surprised /var/www/html , which is trying to use Apache2.

Now my http://localhost/anything not working (404 error in the browser).

How to fix it? I need to return my http://localhost working with files in /var/www !

Context

I use Ubuntu12 with Apache2, all standard and standard.

I checked the tail /var/log/apache2/error.log error log to find out the exact path that Apache is showing

  ... [core:notice] [pid 1597] AH00094: Command line: '/usr/sbin/apache2' ... [:error] [pid 1604] [client 127.0.0.1:40624] script '/var/www/html/info.php' not found or unable to stat 

The /var/www/html folder is new, everything, for example, '/var/www/info.php', is located in /var/www , and not in /var/www/html .

I fixed the error "AH00094" for editing

  sudo nano /etc/apache2/apache2.conf 

and adding the last line

  ServerName localhost 

(now there are no localhost log errors, but nothing works)

PS: I checked other related problems, but not the same problem: Permissions for / var / www / html , Attempting to use a symlink for var / www / html


I am afraid to use the hints of this answer ... in my Ubuntu there are no specified .conf files. Should I create it? Is safe


As @RahilWazir explained, here is my "/etc/apache2/sites-available/000-default.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 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.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, eg #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> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet 
+6
source share
2 answers

Look here:

Why was the apache2 www directory moved to / var / www / html?

The default directory, apparently (we were also surprised), moved from /var/www to /var/www/html for htdocs in Debian, and Ubuntu copied this change. The reasons given are somewhat clear, but the update path is probably "interesting" (as in the Chinese proverb) ... how did you come across.

+9
source

If you want to use /www as the root folder instead of /www/html , you can simply edit the apache2 configuration file to have / var / www

Edit 000-default.conf

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

then change

 DocumentRoot /var/www/html 

to

 DocumentRoot /var/www 

Reboot apache2 server:

 sudo service apache2 restart 
+2
source

All Articles