[SOLVED] Get 403 on .php test file however .html test file ok
Added by Anonymous almost 13 years ago
Hi,
i've leased a dedicated server for rutorrent seedbox and it's my first experience with web-server and php. When i point my browser to https://serverip/index.html it shows some text but index.php does not. I did "chown -R david:lighttpd srv/" and "chmod –R 755 srv/" so it shouldn't be a problem with permissions. Here's what I've done so far:
@
1. Installed lighttpd, lighttpd-fastcgi, php, php-gd
2. In /etc/lighttpd/lighttpd.conf:
server.port = 62543
$SERVER["socket"] == ":61359" {
ssl.engine = "enable"
ssl.pemfile = "/home/david/cacert.pem"
}
3. In /etc/lighttpd/modules.conf
added mod_fastcgi to modules section
4. In /etc/lighttpd/conf.d/fastcgi.conf
uncommented and edited:
fastcgi.server = ( ".php" => ( "php-local" => ( "socket" => "/tmp/php-fastcgi-1.socket", "bin-path" => "/usr/bin/php-cgi", "max-procs" => 1, "broken-scriptfilename" => "enable", ) ), ( "php-tcp" => ( "host" => "127.0.0.1", "port" => 9999, "check-local" => "disable", "broken-scriptfilename" => "enable", ) ), ( "php-num-procs" => ( "socket" => "/tmp/php-fastcgi-2.socket", "bin-path" => "/usr/bin/php-cgi", "bin-environment" => ( "PHP_FCGI_CHILDREN" => "16", "PHP_FCGI_MAX_REQUESTS" => "10000", ), "max-procs" => 5, "broken-scriptfilename" => "enable", ) ), )
5. Added in /srv/www/lighttpd/index.php
6. usermod –G lighttpd david
7. openssl req -keyout cacert.pem -x509 -new -days 365 -out cacert.pem -nodes
8. chown –R root cacert.pem
9. chmod 400 cacert.pem
10. chown -R david:lighttpd srv/
11. chmod –R 755 srv/
@
System is CentOS 6 x86_x64
lighttpd 1.4.28
php 5.3.3
Thanks in advance
Replies (11)
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
5. added <?php phpinfo(); ?> in /srv/www/lighttpd/index.php
RE: Get 403 on .php test file however .html test file ok - Added by spaam almost 13 years ago
have you tried removing php-tcp and php-num-procs part ? then restart lighttpd and not reloading it ?
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
I'm not sure if i've removed the right lines so just to be sure this is the result:
fastcgi.server = ( ".php" => ( "php-local" => ( "socket" => "/tmp/php-fastcgi-1.socket", "bin-path" => "/usr/bin/php-cgi", "max-procs" => 1, "broken-scriptfilename" => "enable", ) ), )
But after restarting lighttpd unfortunatelly still 403
RE: Get 403 on .php test file however .html test file ok - Added by spaam almost 13 years ago
how does modules.conf look like?
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
server.modules = (
"mod_access",
"mod_fastcgi",
)
Everything else is commented out.
RE: Get 403 on .php test file however .html test file ok - Added by spaam almost 13 years ago
what does lighttpd -pf /etc/lighttpd/lighttpd.conf say?
have you tried stop lighttpd then check if its still running or not then start it again?
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
sudo lighttpd -pf /etc/lighttpd/lighttpd.conf:
config { var.PID = 7727 var.CWD = "/home/david" var.log_root = "/var/log/lighttpd" var.server_root = "/srv/www" var.state_dir = "/var/run" var.home_dir = "/var/lib/lighttpd" var.conf_dir = "/etc/lighttpd" var.vhosts_dir = "/srv/www/vhosts" var.cache_dir = "/var/cache/lighttpd" var.socket_dir = "/var/lib/lighttpd/sockets" server.modules = ( "mod_indexfile", "mod_access", "mod_fastcgi", "mod_accesslog", "mod_dirlisting", "mod_staticfile", # 6 ) server.port = 62543 server.use-ipv6 = "disable" server.username = "lighttpd" server.groupname = "lighttpd" server.document-root = "/srv/www/lighttpd" server.pid-file = "/var/run/lighttpd.pid" server.errorlog = "/var/log/lighttpd/error.log" accesslog.filename = "/var/log/lighttpd/access.log" server.event-handler = "linux-sysepoll" server.network-backend = "linux-sendfile" server.max-fds = 2048 server.stat-cache-engine = "simple" server.max-connections = 1024 index-file.names = ("index.xhtml", "index.html", "index.htm", "default.htm", "index.php") url.access-deny = ("~", ".inc") static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".scgi") mimetype.use-xattr = "disable" mimetype.assign = ( ".pdf" => "application/pdf", ".sig" => "application/pgp-signature", ".spl" => "application/futuresplash", ".class" => "application/octet-stream", ".ps" => "application/postscript", # 5 ".torrent" => "application/x-bittorrent", ".dvi" => "application/x-dvi", ".gz" => "application/x-gzip", ".pac" => "application/x-ns-proxy-autoconfig", ".swf" => "application/x-shockwave-flash", # 10 ".tar.gz" => "application/x-tgz", ".tgz" => "application/x-tgz", ".tar" => "application/x-tar", ".zip" => "application/zip", ".mp3" => "audio/mpeg", # 15 ".m3u" => "audio/x-mpegurl", ".wma" => "audio/x-ms-wma", ".wax" => "audio/x-ms-wax", ".ogg" => "application/ogg", ".wav" => "audio/x-wav", # 20 ".gif" => "image/gif", ".jpg" => "image/jpeg", ".jpeg" => "image/jpeg", ".png" => "image/png", ".xbm" => "image/x-xbitmap", # 25 ".xpm" => "image/x-xpixmap", ".xwd" => "image/x-xwindowdump", ".css" => "text/css", ".html" => "text/html", ".htm" => "text/html", # 30 ".js" => "text/javascript", ".asc" => "text/plain", ".c" => "text/plain", ".cpp" => "text/plain", ".log" => "text/plain", # 35 ".conf" => "text/plain", ".text" => "text/plain", ".txt" => "text/plain", ".spec" => "text/plain", ".dtd" => "text/xml", # 40 ".xml" => "text/xml", ".mpeg" => "video/mpeg", ".mpg" => "video/mpeg", ".mov" => "video/quicktime", ".qt" => "video/quicktime", # 45 ".avi" => "video/x-msvideo", ".asf" => "video/x-ms-asf", ".asx" => "video/x-ms-asf", ".wmv" => "video/x-ms-wmv", ".bz2" => "application/x-bzip", # 50 ".tbz" => "application/x-bzip-compressed-tar", ".tar.bz2" => "application/x-bzip-compressed-tar", ".rpm" => "application/x-rpm", "" => "application/octet-stream", # 54 ) dir-listing.activate = "disable" dir-listing.hide-dotfiles = "disable" dir-listing.exclude = ("~$") dir-listing.encoding = "UTF-8" dir-listing.hide-header-file = "disable" dir-listing.show-header = "disable" dir-listing.hide-readme-file = "disable" dir-listing.show-readme = "disable" server.follow-symlink = "enable" server.upload-dirs = ("/var/tmp") $HTTP["url"] =~ "\.pdf$" { # block 1 server.range-requests = "disable" } # end of $HTTP["url"] =~ "\.pdf$" $SERVER["socket"] == ":61359" { # block 2 ssl.engine = "enable" ssl.pemfile = "/home/david/cacert.pem" } # end of $SERVER["socket"] == ":61359" }
service lighttpd status:
lighttpd is stopped
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
doesn't show lighttpd.pid when stopped
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
When I remove ".php" from "static-file.exclude-extensions" then when loading https://serverip:61365/index.php my browser open a save dialog for index.php file
RE: Get 403 on .php test file however .html test file ok - Added by spaam almost 13 years ago
in modules.conf.. remove the hashtag on the line with include "conf.d/fastcgi.conf"
RE: Get 403 on .php test file however .html test file ok - Added by Anonymous almost 13 years ago
It works! I already knew about "include conf.d/fastcgi" line but when starting lighttpd it always stated: "Cannot load plugin mod_fastcgi more than once, please fix your config (we may not accept such configs in future releases" so I commented it before without even checking the .php test file. But when commenting out the server.modules = (... "mod_fastcgi",) and leaving "include conf.d/fastcgi" uncommented it doesn't complain and still works. So thank you very much.