1

I can't run a php from my custom location:

$ cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>


  ServerAdmin webmaster@localhost
  DocumentRoot /home/alex/Documents/var_www_html


  ErrorLog ${APACHE_LOG_DIR}/error.log
  CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet


$ ls -l  ~/Documents/var_www_html
total 52
drwxr-xr-x 2 alex alex 4096 Oct 25 16:37 dir1
drwxr-xr-x 2 alex alex 4096 Oct 25 16:37 dir2
-rwxr-xr-x 1 alex alex  493 Oct 25 16:37 file1.inc.php
drwxr-xr-x 3 alex alex 4096 Oct 25 16:37 css
-rwxr-xr-x 1 alex alex 3638 Oct 25 16:37 favicon.ico
drwxr-xr-x 2 alex alex 4096 Oct 25 16:37 images
-rwxr-xr-x 1 alex alex 2091 Oct 25 16:37 index.php
drwxr-xr-x 3 alex alex 4096 Oct 25 16:37 js
drwxr-xr-x 2 alex alex 4096 Oct 25 16:37 lib
-rwxr-xr-x 1 alex alex 1081 Oct 25 16:37 LICENSE
-rwxr-xr-x 1 alex alex  719 Oct 25 16:37 README.md
drwxr-xr-x 2 alex alex 4096 Oct 25 16:37 tpl
drwxr-xr-x 3 alex alex 4096 Oct 25 16:37 website_itself

$ ls -ld  ~/Documents/var_www_html
drwxr-xr-x 10 alex alex 4096 Oct 25 16:37 /home/alex/Documents/var_www_html

The error is:

Forbidden

You don't have permission to access / on this server.

Apache/2.4.7 (Ubuntu) Server at localhost Port 80

How come?

0

That error is caused from not having a statement such as the one below within you VirtualHost or in a block etc, or any other block like this:

Options Indexes MultiViews FollowSymLinks

To allow the listing of directory contents, because no default file was found. You can specify a default file with a statement such as the one below in a similar area (so in the VirtualHost, Location etc:

DirectoryIndex index.php index.html index.html.gz error.php idx.php index.html  index.cgi index.pl index.php index.xhtml

Did you have mod_php loaded? Have you thought about using perl under FCGI instead, generally its a bit more secure.

1
  • not having where?
    – Incerteza
    Oct 25 '14 at 14:49

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.