DeployLighttpdPHPServer

From FedoraProject

(Difference between revisions)
Jump to: navigation, search
m (category)
(add firewall setup)
Line 51: Line 51:
 
                               )
 
                               )
 
                             )
 
                             )
 +
    </pre>
 +
  </li>
 +
</ol>
 +
 +
 +
== Firewall Port  Forwarding ==
 +
<ol>
 +
  <li>
 +
    Open the port on the firewall, iptables, for the incoming connection:
 +
    <pre>
 +
$ iptables -I INPUT -p tcp --dport 80 -j ACCEPT
 
     </pre>
 
     </pre>
 
   </li>
 
   </li>

Revision as of 11:03, 15 August 2012

Contents

Introduction

This is the procedures for deploying a lighttpd + PHP server on Fedora. This has been done on Fedora 17 which systemd is built in.


Installation

  1. Install package "php-cli".
  2. Install package "lighttpd".
  3. Install package "lighttpd-fastcgi".
  4. You can install it at once with yum:
    $ su -c "yum install php-cli lighttpd lighttpd-fastcgi"
        

Modules Setup

  1. Gain access as user "root".
  2. Open /etc/lighttpd/lighttpd.conf and uncomment the line:
    ##include "modules.conf"
        
  3. Open /etc/lighttpd/modules.conf and uncomment the line:
    #include "conf.d/fastcgi.conf"
        
  4. Open /etc/lighttpd/conf.d/fastcgi.conf and add the following lines:
    fastcgi.server             = ( ".php" =>
                                   ( "localhost" =>
                                     (
                                       "socket" => "/var/run/lighttpd/php-fastcgi.socket",
                                       "bin-path" => "/usr/bin/php-cgi"
                                     )
                                   )
                                )
        


Firewall Port Forwarding

  1. Open the port on the firewall, iptables, for the incoming connection:
    $ iptables -I INPUT -p tcp --dport 80 -j ACCEPT
        

Service Restart & Testing

  1. Restart the lighttpd server:
    $ su -c systemctl restart lighttpd.service
        
  2. Create a file "test.php" in default home directory "/var/www/lighttpd/", with the following contents:
    <?php echo phpinfo(); ?>
        
  3. Open the page "http://localhost/test.php" for results.