0

I successfully installed xampp-linux-x64-1.8.3-4 in my ubuntu 14.04. The XAMPP is installed in /opt/lampp. I get an 403 Forbidden Error message after I copied a HTML project in htdocs Folder.

What I did and tried:

  1. I copied the project by gksudo nautilus /opt/lampp/htdocs
  2. I tried to change the ownership of the /opt/lampp/htdocs/ to me.
  3. I changed the folder's permissions.

2 Answers 2

0

About the error

The 403 Forbidden Error means that the web server (httpd daemon) cannot access the public documents (the web pages) that need to be served.

Possible results of what you did:

  1. All actions in 1 done by the root user resulting all files owned by root so the httpd daemon cannot access them.

  2. You now have the ownership of /opt/lampp/htdocs/ and this has the same results as number 1 above.

  3. You did not mentioned how the permissions are set now thus it is unclear what is accessible right now.

Possible solution:

In my server, I host all public documents at /srv/www/ but the solution will be the same.

Give the ownership to the httpd daemon (Apache, Nginx, etc), that is:

sudo chown -R www-data:www-data /opt/lampp/htdocs/

Assuming that the httpd daemon is named www-data and belongs to the www-data group, else you will have to adapt it accordingly.

In general when setting a web server you want the server user to be the owner of what will be served. Note this is not the case with languages such like Python where say a Django based project must not live inside the public directory.

0

If you have set your permissions and created your virtual hosts files but still get the error look to your apache config.

The apache2 configuration file now has a default security model that may be preventing your directory being served. I host mine in my home directory which I always have to add to this part of the configuration to apache2.conf.

sudo vim /etc/apache2/apache2.conf

Around line 146 you will see the following section.

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<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>

#<Directory /srv/>
#       Options Indexes FollowSymLinks
#       AllowOverride None
#       Require all granted
#</Directory>

Add your custom web directory to this section. Tweak the other parameters as needed.

<Directory /home/my_custom_directory/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Note: I use drupal which needs the AllowOveride All for the .htaccess file to work. You may not need this in your final config.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.