Table of Contents
If you want to send us your comments, please do so. Thanks
More on comments
lighttpd
Installation
Take notice of the wiki. the configuration tutorial, PHP-fpm about and optimizing fpm performance
Mark for installation (+) in aptitude
- lighttpd
- Do g
- Scroll down to the “Packages which are suggested by other packages” section
- Mark for installation php-cgi. php7.3-cgi also gets marked for installation.
- This procedure installs PHP without installing Apache
- Mark for installation fam (File Alteration Monitor)
- Mark for installation rrdtool
- Do g
Configuration
The configuration file can be checked with: lighttpd -tt -f /etc/lighttpd/lighttpd.conf
- Put a sample .html page in /var/www/html/
- chown -R www-data:www-data /var/www/html/
- Check with a web browser if you can load the page
- Put a sample .php page in /var/www/html/
- Check with a web browser if you can load the page
Issues
PHP > 403 Forbidden
- Make sure file permissions are www-data:www-data for the root directory of the website and all the files in it.
- Read: /var/log/lighttpd/error.log
- vi /etc/modules-load.d/modules.conf and check if
server.modules = ( "mod_access", "mod_fastcgi", # "mod_alias", # "mod_auth", # "mod_evasive", # "mod_redirect", # "mod_rewrite", # "mod_setenv", # "mod_usertrack", )
is in it
- Start the fastcgi services by running lighty-enable-mod and then entering fastcgi fastcgi-php
- Then run service lighttpd force-reload; systemctl status lighttpd.service # systemctl start lighttpd.service might be needed if lighttpd is not started
- Maybe do
- Run
ln -s /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/ ln -s /etc/lighttpd/conf-available/15-fastcgi-php.conf /etc/lighttpd/conf-enabled
- We got, after running 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 Tue 2021-12-14 15:27:51 UTC; 17s ago Process: 3411 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS) Process: 3417 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION) Main PID: 3417 (code=exited, status=255/EXCEPTION) dec 14 15:27:51 $HOSTNAME systemd[1]: lighttpd.service: Service RestartSec=100ms expired, scheduling restart. dec 14 15:27:51 $HOSTNAME systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 6. dec 14 15:27:51 $HOSTNAME systemd[1]: Stopped Lighttpd Daemon. dec 14 15:27:51 $HOSTNAME systemd[1]: lighttpd.service: Start request repeated too quickly. dec 14 15:27:51 $HOSTNAME systemd[1]: lighttpd.service: Failed with result 'exit-code'.
- Then
#systemctl restart lighttpd.service # systemctl status lighttpd.service ● lighttpd.service - Lighttpd Daemon Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Tue 2021-12-14 15:28:24 UTC; 42ms ago Process: 3543 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS) Process: 3555 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=exited, status=255/EXCEPTION) Main PID: 3555 (code=exited, status=255/EXCEPTION)
- Check for errors with
- journalctl -xe
- Put a index.html file only containing “Hello” in the root direcory of the website
- /etc/lighttpd/lighttpd.conf:
- static-file.exclude-extensions setting: includes “.php” to prevent sending out the sourcecode. This is a security feature
- Still a 403. Work in progress. Has something to do with PHP since index.html loads fine and index.php results in a 403
- Do not combine a PHP-FPM configuration and a PHP-CGI configuration
- If you run the PHP-FPM as an external service leave the “socket” pointing to the PHP-FPM socket
- Remove the /usr/bin/php-cgi from the lighttpd.config file
Do
cd /usr/bin ln -s /usr/sbin/php-fpm7.3 /usr/bin/php-fpm
Installed php-mysql
Follow: Lighttpd and fpm. Use lighty-enable-mod to enable modules in stead of lighttpd-enable-mod
https://forum.opnsense.org/index.php?topic=21523.0
Dokuwiki with lighttpd
More on Dokuwiki
DokuWiki.org info page
- Copy the downloaded Dokuwiki file to /var/www/html
- Do tar xf [the downloaded Dokuwiki file]
- Do chown -R root:root
Issues
No access from other computers
Lighttpd runs fine and is accessable from localhost:
http://localhost
but not from an ohter host (computer)
Possible causes
- A firewall issue. Also check
- iptables -L
- nft (Net Filter Tables)
- Check with netstat -nap | grep lighttpd. You should get something like
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1645/lighttpd tcp6 0 0 :::80 :::* LISTEN 1645/lighttpd unix 2 [ ACC ] STREAM LISTENING 12821366 7701/php-cgi /var/run/lighttpd/php.socket-0 unix 3 [ ] STREAM CONNECTED 12799958 1645/lighttpd
other tbd
Website is not accessable
Check if lighttpd is running
systemctl status lighttpd.service
If not start lighttpd with one of these two commands
systemctl start lighttpd.service /etc/init.d/lighttpd start
When you get
[....] Starting lighttpd (via systemctl): lighttpd.serviceJob for lighttpd.service failed because the control process exited with error code. See "systemctl status lighttpd.service" and "journalctl -xe" for details. failed!
Check if there are any broken links in
/etc/lighttpd/conf-enabled
If so, remove them
Start lighttpd with one of these two commands
systemctl start lighttpd.service /etc/init.d/lighttpd start
and check with
systemctl status lighttpd.service
and by opening a webpage
PHP > 403 Forbidden
Please read dokuwiki_security first
Opening a PHP file in a web browser results in 403 Forbidden
Possible reason: php-fpm is installed
Solution: Change in /etc/lighttpd/conf-available/15-fastcgi-php.conf
"socket" => "/var/run/php/php7.3-fpm.sock", #"socket" => "/var/run/lighttpd/php.socket"
Then run
systemctl restart lighttpd.service; systemctl status lighttpd.service systemctl start php7.3-fpm; systemctl status php7.3-fpm
Reference: Lighttpd server PHP SQLite STEP 2: Configuring Lighttpd and PHP 7.4
PHP > 503 Service Not Available
Opening a PHP file in a web browser results in 503 Service Not Available
Possible reason: php-fpm is installed
Solution: Change in /etc/lighttpd/conf-available/15-fastcgi-php.conf
"socket" => "/var/run/php/php7.3-fpm.sock", #"socket" => "/var/run/lighttpd/php.socket"
Then run
systemctl restart lighttpd.service; systemctl status lighttpd.service
Reference: Lighttpd server PHP SQLite STEP 2: Configuring Lighttpd and PHP 7.4
Main subjects on this wiki: Linux, Debian, HTML, Microcontrollers, Privacy
RSS
Disclaimer
Privacy statement
Bugs statement
Cookies
Copyright © : 2014 - 2024 Webevaluation.nl and the authors
Changes reserved.