Forum

404 error under Arch Linux with Drupal 7

jazzi
21 August 2014, 15:52

Hiawatha version: 9.6
Operating System: Arch Linux
CMS: Drupal 7.3
--------------------------------------------------
Hi, that's my first time with Hiawatha and I LOVE its elegance very much, thank you Hugo and all.

I got an 404-Not Found problem, I googled and read the HOWTO but failed in the end, pls give me some hints, I will appreciate.

Here is my hiawatha.conf:
# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
ServerId = http
ConnectionsTotal = 250
ConnectionsPerIP = 25
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
Interface = 127.0.0.1
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.
#
#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 = php
#TriggerOnCGIstatus = no
#
FastCGIserver {
FastCGIid = PHP5
# ConnectTo = 127.0.0.1:9000
ConnectTo = /var/run/php-fpm/php-fpm.sock
Extension = php
SessionTimeout = 30
}


# 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 = drupal
RequestURI isfile Return
Match ^/favicon.ico$ Return
Match /(.*)\?(.*) Rewrite /index.php?q=$1&$2
Match /(.*) Rewrite /index.php?q=$1
}

VirtualHost {
Hostname = 127.0.0.1
WebsiteRoot = /usr/share/webapps/drupal
UseToolkit = drupal
}


# 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 = /usr/share/webapps/drupal
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
#UseGZfile = yes
ExecuteCGI = yes


And here is the error log:
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 1: ?php: No such file or directory
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 3: /bin: Is a directory
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 4: CHANGELOG.txt: command not found
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 5: CHANGELOG.txt: command not found
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 6: includes/: Is a directory
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 8: /bin: Is a directory
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 9: CHANGELOG.txt: command not found
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 10: includes/: Is a directory
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|/usr/share/webapps/drupal/install.php: line 11: syntax error near unexpected token `'DRUPAL_ROOT','|/usr/share/webapps/drupal/install.php: line 11: `define('DRUPAL_ROOT', getcwd());'
127.0.0.1|Thu 21 Aug 2014 21:38:14 +0000|/usr/share/webapps/drupal/install.php|no output
Hugo Leisink
21 August 2014, 19:17
There are two errors in your configuration:

You have set CGIextension to 'php' while at the same time you have a defined a FastCGI server which also triggers on the php extension. The CGIextension is for CGI which can be executed directly, like compiled C applications or scripts that have the execute bit set (via chmod) and start with #!/path/to/parser.

You have a VirtualHost with the Hostname '127.0.0.1', while the default host has the same 'hostname'. Move the UseToolkit setting to the default host and remove the virtual host.
jazzi
23 August 2014, 13:43
Sorry for late reply, and thanks for the help Hugo.

I commented out the FastCGI server, also moved the UseToolkit seeting to the default host and removed the virtual host.

I type http://127.0.0.1/drupal and got a 500 - Internal Server Error.

Hereby the new error log:
# tail /var/log/hiawatha/error.log 
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 9: CHANGELOG.txt: command not found
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 10: CHANGELOG.txt: command not found
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 11: CHANGELOG.txt: command not found
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 12: includes/: Is a directory
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 14: /bin: Is a directory
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 15: CHANGELOG.txt: command not found
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 16: includes/: Is a directory
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 17: syntax error near unexpected token `'DRUPAL_ROOT','
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|/usr/share/webapps/drupal/index.php: line 17: `define('DRUPAL_ROOT', getcwd());'
127.0.0.1|Sat 23 Aug 2014 19:37:29 +0000|/usr/share/webapps/drupal/index.php|no output


And hereby the revised configuration:
# Hiawatha main configuration file
#


# GENERAL SETTINGS
#
ServerId = http
ConnectionsTotal = 250
ConnectionsPerIP = 25
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
Interface = 127.0.0.1
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.
#
#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 = php
#TriggerOnCGIstatus = no
#
#FastCGIserver {
# FastCGIid = PHP5
# ConnectTo = 127.0.0.1:9000
# ConnectTo = /var/run/php-fpm/php-fpm.sock
# Extension = php
# SessionTimeout = 30
#}


# 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
#}
#



# 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 = /srv/http/hiawatha
WebsiteRoot = /usr/share/webapps/drupal
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
#UseGZfile = yes
ExecuteCGI = yes

UrlToolkit {
ToolkitID = drupal
RequestURI isfile Return
Match ^/favicon.ico$ Return
Match /(.*)\?(.*) Rewrite /index.php?q=$1&$2
Match /(.*) Rewrite /index.php?q=$1
}
UseToolkit = drupal

#VirtualHost {
# Hostname = 127.0.0.1
# WebsiteRoot = /usr/share/webapps/drupal
# UseToolkit = drupal
#}


# VIRTUAL HOSTS
# Use a VirtualHost section to declare the websites you want to host.
#
#VirtualHost {
# Hostname = www.my-domain.com
# WebsiteRoot = /srv/http/my-domain/public
# StartFile = index.php
# AccessLogfile = /srv/http/my-domain/log/access.log
# ErrorLogfile = /srv/http/my-domain/log/error.log
# TimeForCGI = 5
# UseFastCGI = PHP5
# UseToolkit = banshee
#}


# DIRECTORY SETTINGS
# You can specify some settings per directory.
#
#Directory {
# Path = /home/baduser
# ExecuteCGI = no
# UploadSpeed = 10,2
#}
Hugo Leisink
25 August 2014, 08:17
Comment the "CGIextension" setting and uncomment the line "CGIhandler = /usr/bin/php-cgi:php". Make sure you have php-cgi installed. If this works, try the FastCGI version of PHP, because it's about 15 times faster than normal CGI.
jazzi
30 August 2014, 17:43
Thanks Hugo, it does work now. I also installed php-fpm, and uncommented the FastCGIserver section, is that right?
Hugo Leisink
30 August 2014, 20:32
Read the FastCGI section at the CGI and FastCGI howto page to learn how to configure a FastCGI server in Hiawatha.
This topic has been closed.