Forum

owncloud php-fpm

kris99
6 June 2013, 12:52
Hi,

since several days I try to install owncloud on my raspberry pi. The default website of hiawatha is shown as expected. But if I want to use a php script I get a 403 (forbidden).

My configs:

hiawatha:
ServerId = www-data
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log

Binding {
Port = 80
Interface = 192.168.2.101
}
CGIhandler = /usr/bin/php-cgi:php
CGIextension = cgi

FastCGIserver {
FastCGIid = PHP5
ConnectTo = /var/run/php5-fpm.sock
# ConnectTo = 127.0.0.1:2005
Extension = php
}


UrlToolkit {
ToolkitID = ownCloud
Match ^/data DenyAccess
}

Hostname = raspi
WebsiteRoot = /var/www/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi

VirtualHost {
Hostname = owncloud
WebsiteRoot = /var/www/hiawatha/owncloud
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
TimeForCGI = 5
UseFastCGI = PHP5
WebDAVapp = yes
ExecuteCGI = yes
UseToolkit = ownCloud
}


php5.conf
;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;

[global]
pid = /var/run/php5-fpm.pid

error_log = /var/log/php5-fpm.log


[www]

user = www-data
group = www-data

;listen = /var/run/php5-fpm.sock
listen = 127.0.0.1:2005

listen.owner = www-data
listen.group = www-data
listen.mode = 0666

pm = static

pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

chdir = /


I have used sockets and tcp/ip for the php connection and changed other configuration items also.

But all the same 403.

Could anybody help me?



Hiawatha version: 9.1
Operating System: debian armv6l kerne: 3.6.11
Hugo Leisink
6 June 2013, 17:02
What does the error logfile say?
Heiko
16 June 2013, 23:32
I guess you should remove the IP in Binding { ... }
Heiko
16 June 2013, 23:54
Btw, you need a own and separate VirtualHost for Hostname Raspi
The global definition is only for spiders scanning IPs. Its only for security, the default Index.html should be empty.
I think your problem is caused by binding IP and wrong use of VirtualHost. You need 2 VirtualHost.
kris99
19 June 2013, 10:55
This is the output of /var/log/hiawatha/error.log

192.168.2.12|Thu 06 Jun 2013 12:39:02 +0200|/var/www/hiawatha/owncloud/index.php|CGI execution not allowed
192.168.2.12|Thu 06 Jun 2013 12:52:36 +0200|/var/www/hiawatha/owncloud/index.php|CGI execution not allowed

I have added a second VirtualHost and removed the IP in Binding. This doesn't change anything.

Here my 'new' config:
ServerId = www-data
ConnectionsTotal = 150
ConnectionsPerIP = 10
SystemLogfile = /var/log/hiawatha/system.log
GarbageLogfile = /var/log/hiawatha/garbage.log

Binding {
Port = 80
}

CGIhandler = /usr/bin/php-cgi:php
CGIextension = cgi

FastCGIserver {
FastCGIid = PHP5
ConnectTo = /var/run/php5-fpm.sock
# ConnectTo = 127.0.0.1:2005
Extension = php
}


UrlToolkit {
ToolkitID = ownCloud
Match ^/data DenyAccess
}

Hostname = 192.168.2.101
WebsiteRoot = /var/www/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log

VirtualHost {
Hostname = raspi
WebsiteRoot = /var/www/hiawatha
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
}


VirtualHost {
Hostname = owncloud
WebsiteRoot = /var/www/hiawatha/owncloud
StartFile = index.html
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
TimeForCGI = 5
UseFastCGI = PHP5
WebDAVapp = yes
ExecuteCGI = yes
UseToolkit = ownCloud
}

The output of the error.log is the same:

192.168.2.12|Wed 19 Jun 2013 10:47:08 +0200|/var/www/hiawatha/owncloud/index.php|CGI execution not allowed

Any further suggestions?

Hugo Leisink
19 June 2013, 11:26
What hostname did you use in the browser's URL bar?
kris99
19 June 2013, 13:25
I use this URL:

http://192.168.2.101/owncloud/index.php
Hugo Leisink
19 June 2013, 13:28
By using 192.168.2.101, Hiawatha will use the default host configuration (the one with Hostname = 192.168.2.1010). Since that one does not allow CGI execution, you get the error. Use 'owncloud' as the hostname to make it work. You might have to do some hosts or DNS configuration.
kris99
19 June 2013, 16:33
I have edit the file /etc/hosts on my workstation and added the following line:

192.168.2.101 owncloud.localdomain owncloud

Now calling http://owncloud.localdomain shows me the hiawatha default website. But the site http://owncloud.localdomain/owncloud is forbidden like before. The error.log shows the same message.
Hugo Leisink
19 June 2013, 18:10
'owncloud' does not match 'owncloud.localdomain'...
kris99
19 June 2013, 19:43
Arrgh, okay got it.

But now I'm getting a '503 - Service Unavailable' if I use a php file. Simple html files works as expected.
Hugo Leisink
19 June 2013, 19:50
Have you read this HOWTO?
kris99
19 June 2013, 20:10
Yes, but I assume I have forgotten something elementary if I understand your last question correctly

In my first post is the php5.conf which I have created reading your reference. The php5-fpm.log contains only the start message:

[19-Jun-2013 20:08:40] NOTICE: fpm is running, pid 10351
[19-Jun-2013 20:08:40] NOTICE: ready to handle connections

Heiko
21 June 2013, 15:09
Did you try php-fpm with port 9000?

FastCGIserver {
FastCGIid = PHP5
ConnectTo = 127.0.0.1:9000
Extension = php, php5
SessionTimeout = 30
}


And append in /etc/php5/fpm/pool.d/www.conf
when you have
include=/etc/php5/fpm/pool.d/*.conf
in
/etc/php5/fpm/php-fpm.conf

Append this:
[www]
user = www-data
group = www-data
listen = 127.0.0.1:9000
pm = static
pm.max_children = 20

I use raspi with php-fpm and it works on my raspi.
kris99
22 June 2013, 09:20
No I didn't, but your hint let me check my configs once again. There were a mismatch. In hiawatha.conf I used sockets and in php-fpm.conf I used TCP/IP This must be happened when 'fiddling' with the configs trying to get hiawatha working with php.

Now I got the expected connection

Thank you all, specially Hugo, who figured out this 'forbidden 403' error.

Kris
This topic has been closed.