Forum

Hiawatha "Primary script unknown"

Kinsey Ng
10 March 2018, 03:04
Hello, I'm trying to set the Hiawatha with PHP on OpenBSD. But when I trying to open PHP page. It shows "File not found." I set the user and group to hiawatha and also all the permissions are 755. please help.

/etc/hiawatha/hiawatha.conf
# Hiawatha main configuration file
#

# VARIABLES
# With 'set', you can declare a variable. Make sure the name of the
# variable doesn't conflict with any of the configuration options.
# The variables are case-sensitive and cannot be redeclared.
#
#set LOCALHOST = 127.0.0.0/8


# GENERAL SETTINGS
#
#ServerId = www-data
ServerId = _hiawatha
ConnectionsTotal = 1000
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log


# BINDING SETTINGS
# A binding is where a client can connect to.
#
Binding {
Port = 80
}
#
#Binding {
# Port = 443
# TLScertFile = tls/hiawatha.pem
# Interface = 127.0.0.1
# MaxRequestSize = 2048
# TimeForRequest = 30
#}


# 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.
#/usr/local/bin/php-7.0
CGIhandler = /usr/local/bin/php-fastcgi-7.0:php
#CGIhandler = /usr/local/bin/php-fastcgi:php
#CGIhandler = /usr/local/bin/php-7.0:php
#CGIhandler = /usr/local/bin/python:py
#CGIhandler = /usr/local/bin/ruby:rb
#CGIhandler = /usr/bin/ssi-cgi:shtml
#CGIextension = cgi
#
#CGIwrapper = /usr/local/sbin/cgi-wrapper
#
FastCGIserver {
FastCGIid = PHP7
ConnectTo = /var/www/run/php-fpm.sock
# ConnectTo = 127.0.0.1:9000
# ConnectTo = /var/run/rc.d/php70_fpm
Extension = php
ServerRoot = /var/www/htdocs
# ServerRoot = /var/www/htdocs/web
}


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


# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
#Directory {
# DirectoryID = static
# Path = /css, /fonts, /images, /js
# ExpirePeriod = 2 weeks
#}
#
#Directory {
# DirectoryID = files
# Path = /files
# ShowIndex = yes
# StartFile = index.html
# ExecuteCGI = no
#}


# 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 = 127.0.0.1
WebsiteRoot = /var/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log


# VIRTUAL HOSTS
# Use a VirtualHost section for each website you want to host.
#
#VirtualHost {
# Hostname = www.my-domain.com
# WebsiteRoot = /var/www/my-domain/public
# AccessLogfile = /var/www/my-domain/log/access.log
# ErrorLogfile = /var/www/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP7
# UseToolkit = banshee
# UseDirectory = static, files
#}

VirtualHost {

Hostname = www.web.hidden
WebsiteRoot = /var/www/htdocs/web
StartFile = index.php
AccessLogfile = /var/www/log/web/access.log
ErrorLogfile = /var/www/log/web/error.log
UseFastCGI = PHP7
# UseToolkit = banshee
ExecuteCGI = yes
PreventCSRF = yes
PreventSQLi = yes
PreventXSS = yes
RandomHeader = 250
}
Kinsey Ng
10 March 2018, 03:05
tail -f /var/log/hiawatha/error.log

Fri 09 Mar 2018 12:40:14 +0000|/var/www/htdocs/web/index.php|Primary script unknown
172.68.141.113|Fri 09 Mar 2018 12:40:42 +0000|/var/www/htdocs/web/index.php|Primary script unknown
Joe Schmoe
10 March 2018, 13:42
Try commenting out the ServerRoot line and see if that works first. It can be tricky getting PHP to run as chroot. If it works with ServerRoot turned off then your problem is with your PHP configuration.

#ServerRoot = /var/www/htdocs
Joe Schmoe
10 March 2018, 13:44
And comment out this line

CGIhandler = /usr/local/bin/php-fastcgi-7.0:php


You shoudn't need that if you are use php-fpm.
Kinsey Ng
11 March 2018, 04:47
Hello, Thank you for your help. I think it should be some problem related to OpenBSD. I reinstall FreeBSD and reproduce the same configuration. and everything works great now. Thank you!
This topic has been closed.