Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is what I am trying to do.

I tried to add another folder to apache and I get the following error when trying to acces testing/index.html.

The idea is that I would like to have for every customer a folder like /home/neagoe/Work/InterWebs/Projects/[PROJECT NAME]/CustomerProjects/website/dist.

Forbidden

You don't have permission to access /index.html on this server.
Apache/2.2.22 (Ubuntu) Server at testing Port 80

Here are the steps that I followed:

Step1:

sudo chmod a+x /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

Step2:

sudo chown -R www-data:www-data /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

sudo chmod -R 775 /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

Step3:

sudo adduser $USER www-data

Step4:

sudo a2enmod userdir

Step5:

sudo cp /etc/apache/sites-available/default /etc/apache/sites-available/testing

I edited the file /etc/apache/sites-available/testing so it looks like this:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName testing
    DocumentRoot /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist/ >
            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 None
            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>

Step6:

I edited hosts ("/etc/hosts") so it looks like this:

127.0.0.1       localhost 
127.0.0.1       testing


# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Step7:

sudo a2ensite testing
sudo service apache2 restart

I searched for about 2 hours on the internet but I can't figure out what went wrong. All the pages that I found following the same steps as described above.

I know there are similar questions here on the internet, but the answer is to change permission to the directory which I did on Step2.

I am sorry if this is really a duplicate but I could't find the right answer.

Thank you!

PS. I asked this also on AskUbuntu but didn't get any answers so I'm trying my luck here.

Edit:

There isn't much on the error log or the access log.

On the access.log:

::1 - - [10/Aug/2013:11:23:28 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22   (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:29 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:31 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:32 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:33 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:34 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:35 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
127.0.0.1 - - [10/Aug/2013:11:23:23 +0300] "POST /wordpress-testing/wp-cron.php?doing_wp_cron=1376123003.7026669979095458984375 HTTP/1.0" 200 705 "-" "WordPress/3.6; http://localhost/wordpress-testing"
::1 - - [10/Aug/2013:11:23:36 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:37 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
::1 - - [10/Aug/2013:11:23:38 +0300] "OPTIONS * HTTP/1.0" 200 126 "-" "Apache/2.2.22 (Ubuntu) (internal dummy connection)"
127.0.0.1 - - [10/Aug/2013:11:31:32 +0300] "GET /index.html HTTP/1.1" 200 485 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:23.0) Gecko/20100101 Firefox/23.0"

And the last line repeats for about 200 rows.

On the error.log:

1. This lines repeat from time to time.

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525   /msql.so' - /usr/lib/php5/20100525/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Sat Aug 10 13:06:42 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations
[Sat Aug 10 13:07:36 2013] [notice] caught SIGTERM, shutting down
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20100525/msql.so' - /usr/lib/php5/20100525/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Sat Aug 10 13:07:37 2013] [notice] Apache/2.2.22 (Ubuntu) PHP/5.4.9-4ubuntu2.2 configured -- resuming normal operations

2. And this is the predominant error. (hundreds of lines)

[Sat Aug 10 13:07:40 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /index.html denied
share|improve this question
    
Can you include the relevant items from your apache accesslog and errorlog? –  Luc van Donkersgoed Aug 10 '13 at 17:26
    
I included them. –  N Alex Aug 10 '13 at 21:00

2 Answers 2

There are directories above /home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist/ that are overidding the permissions. Try modifying the root directory to

<Directory />
        Options FollowSymLinks
        AllowOverride All
</Directory>

While not a desirable solution that can help weed out where you're getting blocked. I would then try a mixture of Allow and Deny statements in the root directory until you get an acceptable blend of security and functionality.

share|improve this answer
    
I tried this, but still not working. –  N Alex Aug 10 '13 at 18:05
    
throw in an allow from all in the / then maybe? The basic idea is too loosen the permissions within apache to identify the configuration directive that's got you blocked. Is there a httpd.conf anywhere in the apache ServerRoot that might have be tripping you up? –  inetplumber Aug 10 '13 at 18:13
1  
Actually I am going to downvote myself, since I've lead you astray. The error-log infers this wiki.apache.org/httpd/13PermissionDenied so a file level permissions error. Although not recommending this for production, chmod 777 if you're willing to try anything to get it working –  inetplumber Aug 10 '13 at 18:16
    
or chmod 644 just the file /index.html for starters –  inetplumber Aug 10 '13 at 18:24
    
I tried both of your suggestions and still not workig. There was a httpd.conf but it had nothing to block me, anyway I even commented everything on there. Also I tried to move everything to Work1 and ran chmod 777 for Work1 and still nothing. –  N Alex Aug 10 '13 at 18:42

You need to verify that all directories leading to the final directory are accessible by Apache.

/home/neagoe/Work/InterWebs/Projects/testing/CustomerProjects/website/dist

Most commonly, the home directory (/home/neagoe) will have 750 or 700 permission to prevent other users from accessing it. That will be a problem for Apache.

If that's the case, you can chmod 755 it (consider if there are any security risks in doing so in your environment first) or chmod 750 (remember to add Apache to the group that owns the directories in this case).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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