Skip to main content

apache 2.2 - Apache2 randomly stop working, error 403



I just installed a personal Ubuntu Server where I'm working, to test our php websites. This is a 12.04 LTS up to date with LAMP and Samba installed. I set it up to work with the /home/administrateur/www directory as DocumentRoot default directory.




I did so : Added www-data user in administrateur group, recursively gave ug+rwx permissions on admin/.



I changed the default root to /home/administrateur/www in /etc/apache2/sites-available/default



As far, everything's ok... but apache restarts averyday, one or more times, and then, I can't access websites and getting 403 error. The www/ folder, which is usually available via our local network, is no more accessible. But as I connect to the server with putty, everything's doing fine again. This is really weird.



My error log looks like this for this moring :





PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
[Sun Mar 02 06:51:47 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations
[Mon Mar 03 09:10:45 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Mon Mar 03 09:10:45 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Mon Mar 03 09:10:45 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Mon Mar 03 09:47:55 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/favicon.ico
[Mon Mar 03 09:47:55 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/favicon.ico
[Mon Mar 03 09:50:51 2014] [notice] Graceful restart requested, doing restart
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
[Mon Mar 03 09:50:52 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.9 with Suhosin-Patch configured -- resuming normal operations

[Mon Mar 03 09:52:09 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:52:09 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:52:09 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:00 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:00 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:00 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:42 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/fb-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:42 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/twitter-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 09:53:42 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/atd13/wp-content/themes/atd13/img/slideshare-logo-24.png, referer: http://test.atd13.nm/
[Mon Mar 03 11:48:39 2014] [error] [client 192.168.30.51] Erreur de la base de donn\xc3\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$

[Mon Mar 03 11:48:46 2014] [error] [client 192.168.30.51] Erreur de la base de donn\xc3\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$
[Mon Mar 03 11:49:03 2014] [error] [client 192.168.30.51] Erreur de la base de donn\xc3\xa9es WordPress You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use nea$
[Mon Mar 03 16:39:10 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/censier/favicon.ico
[Mon Mar 03 16:39:10 2014] [error] [client 192.168.30.15] File does not exist: /home/administrateur/www/censier/favicon.ico
[Tue Mar 04 06:34:26 2014] [notice] Graceful restart requested, doing restart
Warning: DocumentRoot [/home/administrateur/www] does not exist
Warning: DocumentRoot [/home/administrateur/www/adrexo] does not exist
Warning: DocumentRoot [/home/administrateur/www/atd13] does not exist
Warning: DocumentRoot [/home/administrateur/www/adrexo-blog] does not exist
Warning: DocumentRoot [/home/administrateur/www/censier] does not exist

Warning: DocumentRoot [/home/administrateur/www/friendship] does not exist
Warning: DocumentRoot [/home/administrateur/www/nouvelle-marque] does not exist
Warning: DocumentRoot [/home/administrateur/www/philanthropie] does not exist
Warning: DocumentRoot [/home/administrateur/www/wordpress] does not exist
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/apache2/conf.d/ming.ini on line 1 in Unknown on line 0
[Tue Mar 04 06:34:26 2014] [notice] Apache/2.2.22 (Ubuntu) PHP/5.3.10-1ubuntu3.10 with Suhosin-Patch configured -- resuming normal operations
[Tue Mar 04 09:10:09 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Tue Mar 04 09:10:09 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
[Tue Mar 04 09:10:09 2014] [crit] [client 192.168.30.15] (13)Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable



Here's my /etc/apache2/sites-available/default





ServerAdmin f.lebas@nouvellemarque.com

DocumentRoot /home/administrateur/www

Options FollowSymLinks

AllowOverride All


Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from All


ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/


AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all


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

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow

Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128





and here, my apache2.conf





#
# Based upon the NCSA server configuration files originally by Rob McCool.
#
# This is the main Apache server configuration file. It contains the
# configuration directives that give the server its instructions.
# See http://httpd.apache.org/docs/2.2/ for detailed information about
# the directives.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure

# consult the online docs. You have been warned.
#
# The configuration directives are grouped into three basic sections:
# 1. Directives that control the operation of the Apache server process as a
# whole (the 'global environment').
# 2. Directives that define the parameters of the 'main' or 'default' server,
# which responds to requests that aren't handled by a virtual host.
# These directives also provide default values for the settings
# of all virtual hosts.
# 3. Settings for virtual hosts, which allow Web requests to be sent to

# different IP addresses or hostnames and have them handled by the
# same Apache server process.
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path. If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "foo.log"
# with ServerRoot set to "/etc/apache2" will be interpreted by the
# server as "/etc/apache2/foo.log".
#


### Section 1: Global Environment
#
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests it can handle or where it
# can find its configuration files.
#

#
# ServerRoot: The top of the directory tree under which the server's

# configuration, error, and log files are kept.
#
# NOTE! If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the LockFile documentation (available
# at );
# you will save yourself a lot of trouble.
#
# Do NOT add a slash at the end of the directory path.
#
#ServerRoot "/etc/apache2"


#
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
#
LockFile ${APACHE_LOCK_DIR}/accept.lock

#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars

#
PidFile ${APACHE_PID_FILE}

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than

# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100


#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5

##
## Server-Pool Size Regulation (MPM specific)
##


# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 5
MinSpareServers 5

MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0


# worker MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadLimit: ThreadsPerChild can be changed to this maximum value during a

# graceful restart. ThreadLimit can only be changed by stopping
# and starting Apache.
# ThreadsPerChild: constant number of worker threads in each server process
# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64

ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0


# event MPM
# StartServers: initial number of server processes to start
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process

# MaxClients: maximum number of simultaneous client connections
# MaxRequestsPerChild: maximum number of requests a server process serves

StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0



# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}

#
# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.

#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#

Order allow,deny

Deny from all
Satisfy all


#
# DefaultType is the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value. If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to

# keep browsers from trying to display binary files as though they are
# text.
#
# It is also possible to omit any default MIME type and let the
# client's browser guess an appropriate action instead. Typically the
# browser will decide based on the file's extension then. In cases
# where no good assumption can be made, letting the default MIME type
# unset is suggested instead of forcing the browser to accept
# incorrect metadata.
#

DefaultType None


#
# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., www.apache.org (on) or 204.62.129.132 (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.

#
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a
# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log


#
# LogLevel: Control the number of messages logged to the error_log.
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
#
LogLevel warn

# Include module configuration:
Include mods-enabled/*.load

Include mods-enabled/*.conf

# Include all the user configurations:
Include httpd.conf

# Include ports listing
Include ports.conf

#
# The following directives define some format nicknames for use with

# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
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

# Include of directories ignores editors' and dpkg's backup files,

# see README.Debian for details.

# Include generic snippets of statements
Include conf.d/

# Include the virtual host configurations:
Include sites-enabled/

# mod rewrite


RewriteEngine On



and a ls -lah /home/administrateur/www/ gives me :




drwxrwx--- 21 administrateur administrateur 4,0K févr. 26 14:00 .
drwxrwx--- 6 administrateur administrateur 4,0K mars 4 10:08 ..
drwxrwx--- 7 administrateur administrateur 4,0K févr. 26 14:02 adrexo

drwxrwx--- 6 administrateur administrateur 4,0K févr. 25 17:14 adrexo-blog
drwxrwx--- 6 administrateur administrateur 4,0K févr. 26 13:58 adrexo-blog-corpo
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:10 adrexo-blog_save
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:10 adrexo_save
drwxrwx--- 5 administrateur administrateur 4,0K mars 3 10:10 atd13
drwxrwx--- 5 administrateur administrateur 4,0K mars 3 16:39 censier
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:25 censier_test
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:10 croix-rouge
drwxrwx--- 6 administrateur administrateur 4,0K févr. 20 19:11 friendship
-rwxrwx--- 1 administrateur administrateur 19 févr. 24 16:48 index.php

drwxrwx--- 5 administrateur administrateur 4,0K août 9 2011 nouvellemarque
drwxrwx--- 5 administrateur administrateur 4,0K févr. 18 18:47 nouvelle-marque
drwxrwx--- 5 administrateur administrateur 4,0K févr. 24 17:24 philanthropie
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:32 philanthropie_
drwxrwx--- 23 administrateur administrateur 12K mai 30 2013 prestashop
drwxrwx--- 5 administrateur administrateur 4,0K févr. 19 16:12 sandbox
drwxrwx--- 5 administrateur administrateur 4,0K août 9 2011 surlepont
drwxrwx--- 2 administrateur administrateur 4,0K févr. 18 15:38 vhosts ne pas effacer
drwxrwx--- 5 administrateur administrateur 4,0K févr. 24 17:44 wordpress



Thanks for helping


Answer



It sounds like you may have chosen to encrypt your home directory when setting up Ubuntu.



If this is the case, then your home directory becomes accessible only after you log in to the machine, and after you log out, it will stop being accessible soon afterward.



This is not an appropriate setup for a directory from which files must be served at any time; you should encrypt the entire hard drive instead, with a boot-time passphrase. (Note that this wasn't available in 12.04 LTS and only became available in 12.10.)



To revert this, try ecryptfs-setup-private --undo which will give you the process for undoing an encrypted home directory.



Comments

Popular posts from this blog

linux - iDRAC6 Virtual Media native library cannot be loaded

When attempting to mount Virtual Media on a iDRAC6 IP KVM session I get the following error: I'm using Ubuntu 9.04 and: $ javaws -version Java(TM) Web Start 1.6.0_16 $ uname -a Linux aud22419-linux 2.6.28-15-generic #51-Ubuntu SMP Mon Aug 31 13:39:06 UTC 2009 x86_64 GNU/Linux $ firefox -version Mozilla Firefox 3.0.14, Copyright (c) 1998 - 2009 mozilla.org On Windows + IE it (unsurprisingly) works. I've just gotten off the phone with the Dell tech support and I was told it is known to work on Linux + Firefox, albeit Ubuntu is not supported (by Dell, that is). Has anyone out there managed to mount virtual media in the same scenario?

hp proliant - Smart Array P822 with HBA Mode?

We get an HP DL360 G8 with an Smart Array P822 controller. On that controller will come a HP StorageWorks D2700 . Does anybody know, that it is possible to run the Smart Array P822 in HBA mode? I found only information about the P410i, who can run HBA. If this is not supported, what you think about the LSI 9207-8e controller? Will this fit good in that setup? The Hardware we get is used but all original from HP. The StorageWorks has 25 x 900 GB SAS 10K disks. Because the disks are not new I would like to use only 22 for raid6, and the rest for spare (I need to see if the disk count is optimal or not for zfs). It would be nice if I'm not stick to SAS in future. As OS I would like to install debian stretch with zfs 0.71 as file system and software raid. I have see that hp has an page for debian to. I would like to use hba mode because it is recommend, that zfs know at most as possible about the disk, and I'm independent from the raid controller. For us zfs have many benefits,

apache 2.2 - Server Potentially Compromised -- c99madshell

So, low and behold, a legacy site we've been hosting for a client had a version of FCKEditor that allowed someone to upload the dreaded c99madshell exploit onto our web host. I'm not a big security buff -- frankly I'm just a dev currently responsible for S/A duties due to a loss of personnel. Accordingly, I'd love any help you server-faulters could provide in assessing the damage from the exploit. To give you a bit of information: The file was uploaded into a directory within the webroot, "/_img/fck_uploads/File/". The Apache user and group are restricted such that they can't log in and don't have permissions outside of the directory from which we serve sites. All the files had 770 permissions (user rwx, group rwx, other none) -- something I wanted to fix but was told to hold off on as it wasn't "high priority" (hopefully this changes that). So it seems the hackers could've easily executed the script. Now I wasn't able