-
-
Notifications
You must be signed in to change notification settings - Fork 28
3.6 Lighttpd with php
Tomato6966 edited this page Jun 29, 2021
·
1 revision
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install lighttpd
sudo systemctl start lighttpd
sudo systemctl enable lighttpd
sudo apt-get install mariadb-server mariadb-client -y
sudo mysql_secure_installation
Answer all the questions as shown below:
Change the root password? [Y/n] n
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
sudo apt-get install php php-cgi php-fpm php-mysql -y
sudo nano /etc/php/7.3/fpm/php.ini
Change the following line: (ctrl + w search for it)
cgi.fix_pathinfo=1
sudo nano /etc/php/7.3/fpm/pool.d/www.conf
Find the following line:
listen = /run/php/php7.3-fpm.sock
And replace it with the following line:
listen = 127.0.0.1:9000
sudo systemctl restart php7.3-fpm
sudo nano /etc/lighttpd/conf-available/15-fastcgi-php.conf
Find the following line:s
"bin-path" => "/usr/bin/php-cgi",
"socket" => "/var/run/lighttpd/php.socket",
And replace it with the following lines:
"host" => "127.0.0.1",
"port" => "9000",
sudo lighty-enable-mod fastcgi
sudo lighty-enable-mod fastcgi-php
sudo nano /etc/lighttpd/conf-available/example.com.conf
Add the following lines:
$HTTP["host"] == "www.example.com" {
server.document-root = "/var/www/html/"
server.errorlog = "/var/log/lighttpd/example.com-error.log"
}
Save and close the file when you are finished. Then, enable the Virtual host with the following command:
ln -s /etc/lighttpd/conf-available/example.com.conf /etc/lighttpd/conf-enabled/
Now feel free to code your php website!
sudo nano /var/www/html/index.php
Example Content:
<?php phpinfo(); ?>
Save and close the file. Then, change the ownership of the Lighttpd document root directory to www-data with the following command:
chown -R www-data:www-data /var/www/html/
Finally, restart Lighttpd service to apply all the configuration changes:
systemctl restart lighttpd
-
1 All needed Console Commands
- 1.1 Directory Navigation
- 1.2 System Information
- 1.3 Hardware Information
- 1.4 File and Directory Cmds
- 1.5 Process Management
- 1.6 File Permissions
- 1.7 Networking
- 1.8 Archives (Tar Files)
- 1.9 Search
- 1.10 File Transfers
- 1.11 Disk Usage
- 1.12 User Information and Management
- 1.13 Speedtest
- 1.14 Clear Cache
- 1.15 Disable Sleeping Processes (Suspending)
- 1.16 Remove Welcome Message