Forum

Virtuahosts and PHP5

palehorse
30 December 2012, 08:13
Hi all,

I've just installed Hiawatha and got it up and running with PHP5 for the main site, but the virtual host is having problems with php. When I try to access a virtual hosts .php file I get a Error 503 respond. If I try with a index.html it works just fine. The error logs are empty.

Here's my hiawatha.conf:

# GENERAL SETTINGS
#
#ServerId = nixcon
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /usr/local/var/log/hiawatha/system.log
GarbageLogfile = /usr/local/var/log/hiawatha/garbage.log
ServerString = nixcon

# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
Port = 80
Interface = 172.16.222.132
MaxKeepAlive = 30
TimeForRequest = 3,20
}
#
#Binding {
# Port = 443
# Interface = ::1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
# SSLcertFile = hiawatha.pem
#}


# BANNING SETTINGS
# Deny service to clients who misbehave.
#
#BanOnGarbage = 300
#BanOnMaxPerIP = 60
#BanOnMaxReqSize = 300
#KickOnBan = yes
#RebanDuringBan = yes


# COMMON GATEWAY INTERFACE (CGI) SETTINGS
# These settings can be used to run CGI applications. Use the 'php-fcgi'
# tool to start PHP as a FastCGI daemon.
#
#CGIhandler = /usr/bin/perl:pl
CGIhandler = /usr/bin/php-cgi:php
#CGIhandler = /usr/bin/python:py
#CGIhandler = /usr/bin/ruby:rb
#CGIhandler = /usr/bin/ssi-cgi:shtml
#CGIextension = cgi
#
FastCGIserver {
FastCGIid = PHP5
ConnectTo = 127.0.0.1:2005
Extension = php
}


# URL TOOLKIT
# This URL toolkit rule was made for the Banshee PHP framework, which
# can be downloaded from http://www.hiawatha-webserver.org/banshee
#
#UrlToolkit {
# ToolkitID = banshee
# RequestURI isfile Return
# Match ^/(css|files|images|js|slimstat)($|/) Return
# Match ^/(favicon.ico|robots.txt|sitemap.xml)$ Return
# Match .*\?(.*) Rewrite /index.php?$1
# Match .* Rewrite /index.php
#}
UrlToolkit {
ToolkitID = wordpress
RequestURI exists Return
Match .* Rewrite /index.php
}


# DEFAULT WEBSITE
# It is wise to use your IP address as the hostname of the default website
# and give it a blank webpage. By doing so, automated webscanners won't find
# your possible vulnerable website.
#
Hostname = 172.16.222.132
WebsiteRoot = /var/www/wordpress
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
ExecuteCGI = yes
UseToolkit = wordpress

# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
VirtualHost {
Hostname = labb2.local
WebsiteRoot = /var/www/test
StartFile = index.php
#StartFile = index.html
AccessLogfile = /var/www/test/logs/access.log
ErrorLogfile = /var/www/test/logs/error.log
TimeForCGI = 5
UseFastCGI = PHP5
#UseToolkit = wordpress
}


# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
#Directory {
# Path = /home/baduser
# ExecuteCGI = no
# UploadSpeed = 10,2
#}

Hiawatha version: 8.6
Operating System: Debian 6 amd64
Hugo Leisink
30 December 2012, 08:16
A 503 error means that Hiawatha can't connect to your PHP FastCGI daemon. Make sure it runs and is configured correctly.
palehorse
30 December 2012, 09:11
The default website is working without any problems and serves php files.
Hugo Leisink
30 December 2012, 09:12
Sure, but that one doesn't use FastCGI.
This topic has been closed.