Install Lighttpd with PHP5 and MySQL (LLMP Stack) on Ubuntu 14.04

  • Last Created On Dec 08, 2024
  • 12
0 0

Lighttpd is a popular event-based web server alternative to Nginx. Lighttpd can be used to serve high traffic sites even on a small VPS.

Here, I will explain how to install Lighttpd with PHP 5 (PHP5-FPM) and MySQL on Ubuntu 14.04.

Step 1: Install Lighttpd

Install Lighttpd with the following commands.

sudo apt-get update
sudo apt-get install lighttpd

This will start Lighttpd once the install finishes. You can test the status of the server by accessing the IP address of your VPS in a web browser. Upon success, you will see the Lighttp welcome page.

If the page does not load, you can force-restart the service.

sudo service lighttpd start

Step 2: Install PHP 5

Install PHP5 with the following command.

sudo apt-get install php5-cgi php5-mysql

Note that the “php5-mysql” package is needed to use MySQL server with PHP.

Step 3: Enable FastCGI

Enable PHP5 CGI modules in Lighttpd with the following commands.

sudo lighty-enable-mod fastcgi 
sudo lighty-enable-mod fastcgi-php

After enabling the modules, you need to restart the Lighttpd service.

sudo service lighttpd force-reload

Step 4: Test PHP integration

Test the PHP integration with Lighttpd. To do this, create a test file inside the /var/www/ folder.

nano /var/www/info.php

Paste the following content into this file.

<?php phpinfo(); ?>

Now, access http://[SERVER_IP]/info.php in your web browser. If the configuration was setup properly, you will see the PHP info page.

Step 5: Install MySQL

Run the following command to install MySQL server. During the installation, you need to give the administrator password for MySQL root.

sudo apt-get install mysql-server

Once the install finishes, install a MySQL database.

mysql_install_db

Additionally, you can use the secure MySQL installation by running the following command.

mysql_secure_installation
Views: 12

Recent Articles

  • How to Install JAX with ROCm Acceleratio...
    96
  • Deploy a PyTorch Workspace on a Vultr Cl...
    71
  • Managing Backup Storage
    82
  • Automating FTP Backups in Windows Server
    71
  • Automating FTP Backups in Linux
    75

Popular Articles

  • Our General Terms & Conditions
    2630
  • Our Privacy Policy
    2477
  • Our Cookies Policy
    275
  • Our Terms of Use
    152
  • How to Install JAX with ROCm Acceleratio...
    96