3

i have newly installed lighttpd in ubuntu 9.10 first it showed the detault page and i changed the permission of /var/www/ directory to 777 and now its saying 403 forbidden

my php-cgi -v

PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cgi-fcgi) (built: Jan  6 2010 22:34:28)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

php -v

PHP 5.2.10-2ubuntu6.4 with Suhosin-Patch 0.9.7 (cli) (built: J
6) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

and i have added these line in lighttpd.conf file

fastcgi.server = ( ".php" => ((
                     "bin-path" => "/usr/bin/php-cgi",
                     "socket" => "/tmp/php.socket"
                 )))

still getting same error....

2
  • Logs. Always check your logs, you'll probably find an answer in lighttpd error log.
    – rvs
    Feb 6, 2012 at 6:39
  • 2
    @rvs - lighttpd does not seem to log reasons for a 403, at least not out of the box. Jan 9, 2013 at 17:37

2 Answers 2

1

Most probably the user you are running Lighttpd on doesn't have access to /var/

2
  • 2
    Why does it need access to /var when the docroot is /var/www? Jan 9, 2013 at 17:36
  • This was the solution to the problem for me, however illogical it might sound.
    – SoptikHa
    Dec 25, 2020 at 0:09
1

A couple suggestions about what might be wrong:

Permissions on the directory /var/www are 777 (a bad practice, by the way) - but are the subdirectories all readable by the web server?

Check your php error log and your lighttpd error log. (They may be the same file, depending on your php configuration). Are there any errors in the log about permissions, or about anything else?

Is php-cgi running? Check to make sure that it has permission to write to the socket in /tmp, and that lighttpd does as well.

Check your lighttpd configuration. Do you have access rules that may be causing you to get a forbidden message?

You must log in to answer this question.