Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Lighttpd»How to Install Lighttpd with PHP and MariaDB on CentOS/RHEL 6/5

    How to Install Lighttpd with PHP and MariaDB on CentOS/RHEL 6/5

    RahulBy RahulApril 20, 20142 Mins Read

    Lighttpd is an alternative to Apache. It is a opensource web server. Lighttpd is popular for its low memory and cpu uses, This can be best option for high traffic sites. PHP is a programming language used server-side programming. MariaDB is an alternative of MySQL with various of enhancements.

    Step 1: Add Required Yum Repositories

    Before starting setup, make sure that we have required yum repositories added in our system. We recommend to add MariaDB, EPEL and REMI yum repositories in our system.

    https://downloads.mariadb.org/mariadb/repositories/#mirror=nus
    https://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/#centalt-repo
    https://tecadmin.net/top-5-yum-repositories-for-centos-rhel-systems/#remi-repo

    Step 2: Install Lighttpd

    Lets start with the installation of lighttpd web server with fastcgi support using following command

    # yum install lighttpd lighttpd-fastcgi
    

    Now edit Lighttpd configuration file /etc/lighttpd/lighttpd.conf and update following values.

    server.use-ipv6 = "disable"
    server.max-fds = 2048
    

    Now start Lighttpd service

    # service lighttpd start
    

    Step 3: Install MariaDB

    Assuming that you have already added MariaDB yum repositories, Let’s use the following command to install MariaDB on your system

    # yum install MariaDB-server MariaDB-client
    

    Start MaraiDB service

    # service mysql start
    

    Complete the post installation setup to secure your MariaDB

    # mysql_secure_installation
    

    Step 4: Install PHP and PHP-FPM

    Install PHP, PHP-FPM and php-mysql packages using below command

    # yum --enablerepo=epel,remi install php php-fpm php-mysql
    

    Edit configuration file /etc/php-fpm.d/www.conf an update following values

     listen = 127.0.0.1:9000
     user = lighttpd
     group = lighttpd
    

    Step 5: Configure FASTCGI and PHP-FPM

    Enable PHP5 in Lighttpd, Edit the php configuration file /etc/php.ini and uncomment following line

     cgi.fix_pathinfo=1
    

    Now edit Lighttpd modules configuration /etc/lighttpd/modules.conf and uncomment following line to enable fastcgi support

     include "conf.d/fastcgi.conf"
    

    Now edit Lighttpd fastcgi configuration file /etc/lighttpd/conf.d/fastcgi.conf and add following values

    fastcgi.server += ( ".php" =>
            ((
                    "host" => "127.0.0.1",
                    "port" => "9000",
                    "broken-scriptfilename" => "enable"
            ))
    )
    

    Restart all services using following commands and enable them to auto start on system boot

    # service lighttpd restart
    # service php-fpm restart
    
    # chkconfig lighttpd on
    # chkconfig php-fpm on
    

    Step 6: Verify Setup

    At this point we have successfully completed all the configuration. Lets create an info.php file in your document root with following content.

    <?php
    phpinfo();
    ?>
    

    php-with-lighttpd

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleInstall Lighttpd Web Server on CentOS/RHEL 6/5 using Yum
    Next Article How To Upgrade Ubuntu To 22.04 LTS (Jammy Jellyfish)

    Related Posts

    How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04

    Updated:May 9, 20223 Mins Read

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How To Install MySQL Server on Ubuntu 22.04

    Updated:April 6, 20224 Mins Read

    How To Install and Use PHP Composer on Debian 11

    Updated:February 16, 20224 Mins Read

    How To Install PHP (8.1, 7.4 & 5.6) on Debian 11

    Updated:February 16, 20224 Mins Read

    How To Change MySQL User Password

    2 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Install Sublime Text 4 on Ubuntu 22.04
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.