mitchellurgero / openrsd

Open Raspberry Pi Server Dashboard
Apache License 2.0
39 stars 13 forks source link

Forbidden #37

Closed Racass closed 5 years ago

Racass commented 5 years ago

I can access localhost from pi and outside it, and shows me index.html from lighttpd. But when i try to access /openrsd i receive 403 - forbidden error. Inside pi and outside. my ls -la from /var/www/html shows www-data as user

mitchellurgero commented 5 years ago

Can you give me the output of: la -la /var/www/html and tail -n50 /var/log/lighttpd/error*

Racass commented 5 years ago

I think it was the output of:

ls -la /var/www/html

pi@raspberrypi:~ $ ls -la /var/www/html total 16 drwxr-xr-x 3 www-data www-data 4096 Mar 8 19:55 . drwxr-xr-x 4 www-data www-data 4096 Mar 8 19:43 .. -rw-r--r-- 1 www-data www-data 3378 Mar 8 19:44 index.lighttpd.html drwxr-xr-x 13 www-data www-data 4096 Mar 8 19:55 openrsd

About tail -n50:

tail: cannot open '/var/log/lighttpd/error*' for reading: No such file or directory

Some additional info:
If a try to access /var/log/lighttpd, I receive the following error:

-bash: cd: /var/log/lighttpd: Permission denied

mitchellurgero commented 5 years ago

Please use sudo for the commands

Racass commented 5 years ago

I used sudo already.

pi@raspberrypi:~ $ sudo tail -n50 /var/log/lighttpd/error tail: cannot open '/var/log/lighttpd/error' for reading: No such file or directory pi@raspberrypi:~ $ sudo tail -n50 /var/log/lighttpd/error tail: cannot open '/var/log/lighttpd/error' for reading: No such file or directory

using sudo su I accessed the /var/log/lighttpd and get this file "error.log". The content is as follow:

2019-03-08 19:44:05: (log.c.217) server started 2019-03-08 19:55:02: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 19:55:02: (log.c.217) server started 2019-03-08 19:55:02: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored) 2019-03-08 19:55:18: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 19:55:19: (log.c.217) server started 2019-03-08 19:55:19: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored) 2019-03-08 19:57:55: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 19:58:02: (log.c.217) server started 2019-03-08 19:58:02: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored) 2019-03-08 20:00:05: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 20:00:05: (log.c.217) server started 2019-03-08 20:00:05: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored) 2019-03-08 20:06:25: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 20:06:26: (log.c.217) server started 2019-03-08 20:06:26: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored) 2019-03-08 20:06:40: (server.c.1828) server stopped by UID = 0 PID = 1 2019-03-08 20:06:44: (log.c.217) server started 2019-03-08 20:06:44: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored)

Racass commented 5 years ago

After a fresh install of raspbian I could made it working. Thanks! I had apache2 installed before, maybe that was the problem

mitchellurgero commented 5 years ago

Glad you got it work. For those that have this problem again, lighttpd was not configured for php properly:

2019-03-08 19:58:02: (server.c.1295) WARNING: unknown config-key: fastcgi.server 

For lighttpd you must enable the modules fastcgi and fastcgi-php for PHP to work.

boelle commented 5 years ago

i also get the 403 forbidden error

pi@VPNServer:/var/www/html $ sudo la -la /var/www/html
sudo: la: command not found
pi@VPNServer:/var/www/html $ sudo tail -n50 /var/log/lighttpd/error*
tail: cannot open '/var/log/lighttpd/error*' for reading: No such file or directory

how do i enable fast cgi and fastcgi-php ?

i'm on debian Stretch Lite

boelle commented 5 years ago
pi@VPNServer:/var/www/html $ sudo lsof -i TCP:80
COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
lighttpd 12666 www-data    4u  IPv4  26188      0t0  TCP *:http (LISTEN)
lighttpd 12666 www-data    5u  IPv6  26189      0t0  TCP *:http (LISTEN)
boelle commented 5 years ago

there is a part of the readme that is not quite clear to me

cat << EOF | sudo tee /etc/lighttpd/conf-available/15-fpm-php.conf
fastcgi.server += (".php" => ((
    "socket" => "/run/php/php7.0-fpm.sock"
)))
EOF

do i just copy and paste that in to command line and run it?

boelle commented 5 years ago
pi@VPNServer:/var/www/html $ sudo lighttpd-enable-mod fastcgi-php
Met dependency: fastcgi
Enabling fastcgi-php: ok
Enabling fastcgi: ok
Run "service lighttpd force-reload" to enable changes
pi@VPNServer:/var/www/html $ sudo service lighttpd force-reload
Job for lighttpd.service failed because the control process exited with error code.
See "systemctl status lighttpd.service" and "journalctl -xe" for details.
pi@VPNServer:/var/www/html $
boelle commented 5 years ago
pi@VPNServer:/var/www/html $ systemctl status lighttpd.service
● lighttpd.service - Lighttpd Daemon
   Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2019-04-24 21:41:22 BST; 8s ago
  Process: 12931 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
  Process: 13066 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=255)
 Main PID: 12931 (code=exited, status=0/SUCCESS)

Apr 24 21:41:22 VPNServer systemd[1]: Failed to start Lighttpd Daemon.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Unit entered failed state.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
Apr 24 21:41:22 VPNServer systemd[1]: Stopped Lighttpd Daemon.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Start request repeated too quickly.
Apr 24 21:41:22 VPNServer systemd[1]: Failed to start Lighttpd Daemon.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Unit entered failed state.
Apr 24 21:41:22 VPNServer systemd[1]: lighttpd.service: Failed with result 'exit-code'.
pi@VPNServer:/var/www/html $
boelle commented 5 years ago

Apr 24 21:50:21 VPNServer lighttpd[13334]: 2019-04-24 21:50:21: (configfile.c.1154) source: /etc/lighttpd/conf-enabled/15-fpm-php.conf line: 4 pos: 1 parser failed somehow near here: (EOL)

think that is what prevents is from starting, will see if i can make it start and if the 403 has gone away

@mitchellurgero does it look ok otherwise?

boelle commented 5 years ago
pi@VPNServer:/var/www/html $ sudo lighttpd-enable-mod fastcgi-php
Enabling fastcgi-php: ok
Run "service lighttpd force-reload" to enable changes
pi@VPNServer:/var/www/html $ sudo service lighttpd force-reload
pi@VPNServer:/var/www/html $ sudo lsof -i TCP:80

so it stops with listning and i get connection refused

pi@VPNServer:/var/www/html $ sudo lighttpd-disable-mod fastcgi-php
Disabling fastcgi-php
Run "service lighttpd force-reload" to enable changes
pi@VPNServer:/var/www/html $ sudo service lighttpd force-reload
pi@VPNServer:/var/www/html $ sudo lsof -i TCP:80
COMMAND    PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
lighttpd 15354 www-data    4u  IPv4  49903      0t0  TCP *:http (LISTEN)
lighttpd 15354 www-data    5u  IPv6  49904      0t0  TCP *:http (LISTEN)

it now runs but with 403

mitchellurgero commented 5 years ago

REDACTED