1

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 [email protected]

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

6
  • Your post talks about files being in /home/admin/www, but the log lines talk about /home/administrateur/.htaccess. Double-check your config; please add the relevant config lines to your post (using edit on the post, not in a comment) .
    – Jenny D
    Mar 4, 2014 at 8:46
  • I said admin as a generic word. It's administrateur. I edit my post and stay aware of solutions from the community :) Correction done ;)
    – Neovea
    Mar 4, 2014 at 8:51
  • 2
    I see - please in the future don't use generic words when describing your configuration, it is really confusing :-)
    – Jenny D
    Mar 4, 2014 at 8:52
  • But it is still wrong - your server is looking for /home/administrateur/.htaccess while it should be looking for /home/administrateur/www/.htaccess. We really need to see some config in order to help you.
    – Jenny D
    Mar 4, 2014 at 8:53
  • I updated my post with apache2.conf, default, a ls -lah on www. Hope it'll help.
    – Neovea
    Mar 4, 2014 at 9:12

2 Answers 2

3

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.

3
  • Ok, I can't just do that right now cause we're working on it. But I'll try that and let you know. Thanks
    – Neovea
    Mar 4, 2014 at 15:19
  • I did it this morning. I'll wait a bit to see if it's ok. If not I'll explore other solutions.
    – Neovea
    Mar 5, 2014 at 9:15
  • I can confirm today that the matter was the encrypted partition of my home. I followed the instructions in the link given by Mickael : help.ubuntu.com/community/FullDiskEncryptionHowto It worked fine for me :) Thanks
    – Neovea
    Mar 6, 2014 at 13:18
1

The log entry gives a critical error and the solution:

Permission denied: /home/administrateur/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

That looks like erroneous permissions on an actual .htaccess file or insufficient permissions for apache on your home directory to perform a directory listing to check if such a file exists.

I think you don't want apache looking for a htaccess file there, but the reason that apache does check for the existence of a htaccess file in your home directory too and not only in the www subdirectory is strange, maybe a because your DocumentRoot specification?

DocumentRoot /home/administrateur/www

should be

DocumentRoot "/home/administrateur/www"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .