LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-28-2015, 10:08 PM   #1
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Rep: Reputation: 264Reputation: 264Reputation: 264
Apache not working properly after update to Debian 8


Hi,
I just upgraded my server from Debian 7 to Debian 8. Everything seemed to go fine. However, Apache doesn't seem to be able to see the web files. If I go to my server's IP, I get an empty directory listing, as if the document root was pointed to an empty directory. However, my apache.conf points to /var/www, and there are indeed files there:
Code:
root@maples-server:~# ls -la /var/www/
total 624
drwxr-xr-x  5 www-data www-data   4096 Apr 28 19:35 .
drwxr-xr-x 13 root     root       4096 Mar 28 11:43 ..
lrwxrwxrwx  1 www-data www-data     18 Jan 10 20:47 anthony -> /home/anthony/web/
-rw-------  1 www-data www-data   1455 Apr 23 21:41 .bash_history
-rw-r--r--  1 www-data www-data   3388 Jan 21 19:34 .bashrc
drwxr-xr-x 11 www-data www-data   4096 Apr 23 21:41 chat
lrwxrwxrwx  1 www-data www-data     14 Mar 23 16:20 dad -> /home/dad/web/
drwxr-xr-x  2 root     root       4096 Mar 15 05:52 html
-rw-r--r--  1 www-data www-data    323 Mar 26 18:35 index.htm
drwx------  2 www-data www-data   4096 Jan 21 19:50 Mail
-rw-r--r--  1 anthony  anthony  592795 Apr 23 19:52 phpfreechat-1.7.tar.gz
-rw-r--r--  1 www-data www-data     41 Apr 15 21:52 robots.txt
-rw-------  1 www-data www-data   1541 Apr 23 21:41 .viminfo
Here's my apache.conf (with the comments stripped; there were no "end of line" comments):

Code:
root@maples-server:~# cat /etc/apache2/apache2.conf | grep -v "#"

Mutex file:${APACHE_LOCK_DIR} default

PidFile ${APACHE_PID_FILE}

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 5


User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

Include ports.conf


<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied
</Directory>

<Directory /usr/share>
	AllowOverride None
	Require all granted
</Directory>

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted
</Directory>

AccessFileName .htaccess

<FilesMatch "^\.ht">
	Require all denied
</FilesMatch>


LogFormat "v:p h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf
I also checked sites-enabled/000-default, and everything seems to be fine there:
Code:
root@maples-server:~# cat /etc/apache2/sites-enabled/000-default 
<VirtualHost *:80>

	DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>

	ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
	<Directory "/usr/lib/cgi-bin">
		AllowOverride All
		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
		Order allow,deny
		Allow from all
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log

	# Possible values include: debug, info, notice, warn, error, crit,
	# alert, emerg.
	LogLevel warn

	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Additionally, the connections are no longer showing up in /var/log/apache2/access.log. The last access time in that file is from before the update. I don't know enough about systemd to know if it is responsible for redirecting the logs to somewhere else...

At this point, I have no idea why it's not working. If anyone could point me in the right direction, I would really appreciate it.
Thanks!

EDIT: After looking around some more, it seems that the output of "apachectl -S" is helpful. So here it is:
Code:
root@maples-server:~# apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: ENABLE_USR_LIB_CGI_BIN
User: name="www-data" id=33
Group: name="www-data" id=33
It appears that it's looking in a subdirectory html, which was not the case previously (before the upgrade). I've currently got a (ugly but useable) work-around using a symlink:
Code:
root@maples-server:~# cd /var/www/
root@maples-server:/var/www# rm -r html/
root@maples-server:/var/www# ln -s /var/www/
root@maples-server:/var/www# mv www html
root@maples-server:/var/www# ls -l html
lrwxrwxrwx 1 root root 9 Apr 28 22:36 html -> /var/www/
While this does work, I'd like to find the proper way of doing it. Any ideas?

Last edited by maples; 04-28-2015 at 10:39 PM. Reason: Found an ugly work-around
 
Old 04-28-2015, 11:52 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 518

Rep: Reputation: 177Reputation: 177
Just a wag, but in apache2.conf you have:
Code:
IncludeOptional sites-enabled/*.conf
Try renaming the symlink in /etc/apache2/sites-enabled to 000-default.conf
 
1 members found this post helpful.
Old 04-29-2015, 02:22 AM   #3
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: Debian w/Xfce, LFS 7.9, ++
Posts: 117

Rep: Reputation: Disabled
Hi maples,

Looking at your apache.conf above it seems, (AFAIK), you are using the new Apache 2.4 access
control syntax:

Code:
Require all denied

Require all granted
However, in your sites-enabled/000-default above, I see you are using the older Apache 2.2.x
access control syntax:

Code:
Order allow,deny
allow from all
Just taking a shot here, but is it possible during the upgrade to Jessie you
also upgraded Apache?

If so, you may want to check out this link
in: Chapter 5. Issues to be aware of for jessie
5.5. Incompatible changes in Apache HTTPD 2.4 where it states:

Quote:
..syntax has changed. Notably, the access control directives have changed considerably..
Also this Apache Link: Upgrading to 2.4 from 2.2


(Edit) I also noticed at the bottom of your posted apache.conf
the directives are:

Code:
IncludeOptional conf-enabled/*.conf

IncludeOptional sites-enabled/*.conf
And your default site is named: sites-enabled/000-default
Notice it does not have the .conf suffix which may cause it not to be
loaded(included). It's possible the whole default-000 file including the <Directory /var/www/>
directive is not being used and apache is defaulting to what
you show above via the apachectl -S command:

Code:
Main DocumentRoot: "/var/www/html"
which seems to be what you describe.


Hope that helps,

Tim

Last edited by Tim Abracadabra; 04-29-2015 at 02:55 AM. Reason: Noticed another possible issue
 
3 members found this post helpful.
Old 04-29-2015, 06:02 PM   #4
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
Thanks for the input!

You were correct about needing the .conf extension. I have both 000-default and defauld-ssl in there, and before I changed anything I tried connecting via HTTPS, and it was not listening. I copied over the new config files (from sites-availble; when I setup the server I made copies because I made some changes and wanted to keep the original), merged my additions, and made sure to include the .conf suffix. Now HTTPS is working, but apachectl still shows the DocumentRoot as /var/www/html.

This is what my (hopefully) corrected 000-default.conf looks like:
Code:
root@maples-server:~# grep -v "#" /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	DocumentRoot /var/www
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>
I'm not seeing anything wrong, yet I still get this:
Code:
root@maples-server:~# apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80                   127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
*:443                  127.0.1.1 (/etc/apache2/sites-enabled/default-ssl.conf:2)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl 
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: ENABLE_USR_LIB_CGI_BIN
User: name="www-data" id=33
Group: name="www-data" id=33
My apache2.conf is still the same as before.

Last edited by maples; 04-29-2015 at 06:05 PM. Reason: Added emphasis on the incorrect DocumentRoots; typo
 
Old 04-30-2015, 04:47 PM   #5
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 518

Rep: Reputation: 177Reputation: 177
The compiled in document root was changed to /var/www/html in Debian. See discussion here.

From the apache2 changelog:
Quote:
apache2 (2.4.9-2) unstable; urgency=medium

* Fix logic in postinst to detect existing index.* files in both
DocumentRoots, the old /var/www and the new /var/www/html. Also
change the compiled in default DocumentRoot to /var/www/html.
Closes: #743915

. . .

-- Stefan Fritsch <sf@debian.org> Sun, 08 Jun 2014 10:38:04 +0200
To change the server default document root, put a "Document Root" statement in httpd.conf.
 
1 members found this post helpful.
Old 04-30-2015, 05:42 PM   #6
maples
Member
 
Registered: Oct 2013
Location: IN, USA
Distribution: Arch, Debian Jessie
Posts: 810

Original Poster
Rep: Reputation: 264Reputation: 264Reputation: 264
Quote:
Originally Posted by norobro View Post
To change the server default document root, put a "Document Root" statement in httpd.conf.
That worked!

I'm still not sure why it ignored the DocumentRoot directives in my 000-default.conf and default-ssl.conf files, but it's working fine now.

Just to clarify for future readers, I added
Code:
DocumentRoot /var/www
to the end of my /etc/apace2/apache2.conf (On Debian, it's apache2.conf, but on other distros it seems like it might be httpd.conf)

Thanks again!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP not working properly with Apache home server Shreeve Linux - Software 4 10-19-2011 04:24 PM
pwauth is not working properly under Apache bombshell Linux - Server 0 12-27-2010 07:15 PM
Qtcurve not working properly anymore after KDE update on Gentoo manti111 Gentoo 3 10-12-2009 10:21 AM
Mandrake Update isn't working properly statist Mandriva 0 03-14-2004 01:45 PM


All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration