From Fedora Project Wiki
(add firewall setup) |
(add create socket folder) |
||
Line 2: | Line 2: | ||
== Introduction == | == 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. | This is the procedures for deploying a lighttpd + PHP server on Fedora. This has been done on Fedora 17 which systemd is built in. | ||
* Log in as "root" user before doing the followings: | |||
<pre> | |||
$ su - | |||
</pre> | |||
Line 51: | Line 56: | ||
) | ) | ||
) | ) | ||
</pre> | |||
</li> | |||
<li> | |||
Create a lighttpd accessible directory for the socket: | |||
<pre> | |||
mkdir -p /var/run/lighttpd | |||
chmod 775 /var/run/lighttpd | |||
chgrp lighttpd lighttpd | |||
</pre> | </pre> | ||
</li> | </li> | ||
Line 56: | Line 69: | ||
== | == Configuration of Runtime == | ||
<ol> | <ol> | ||
<li> | <li> | ||
Line 71: | Line 84: | ||
Restart the lighttpd server: | Restart the lighttpd server: | ||
<pre> | <pre> | ||
systemctl restart lighttpd.service | |||
</pre> | </pre> | ||
</li> | </li> |
Revision as of 11:20, 15 August 2012
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.
- Log in as "root" user before doing the followings:
$ su -
Installation
- Install package "php-cli".
- Install package "lighttpd".
- Install package "lighttpd-fastcgi".
-
You can install it at once with yum:
$ su -c "yum install php-cli lighttpd lighttpd-fastcgi"
Modules Setup
- Gain access as user "root".
-
Open /etc/lighttpd/lighttpd.conf and uncomment the line:
##include "modules.conf"
-
Open /etc/lighttpd/modules.conf and uncomment the line:
#include "conf.d/fastcgi.conf"
-
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" ) ) )
-
Create a lighttpd accessible directory for the socket:
mkdir -p /var/run/lighttpd chmod 775 /var/run/lighttpd chgrp lighttpd lighttpd
Configuration of Runtime
-
Open the port on the firewall, iptables, for the incoming connection:
$ iptables -I INPUT -p tcp --dport 80 -j ACCEPT
Service Restart & Testing
-
Restart the lighttpd server:
systemctl restart lighttpd.service
-
Create a file "test.php" in default home directory "/var/www/lighttpd/", with the following contents:
<?php echo phpinfo(); ?>
- Open the page "http://localhost/test.php" for results.