<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Debian Tutorials &#187; lighttpd</title>
	<atom:link href="http://www.debiantutorials.com/tag/lighttpd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.debiantutorials.com</link>
	<description>Copy/Paste tutorials for Debian Linux</description>
	<lastBuildDate>Wed, 18 Aug 2010 00:35:59 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Install Lighttpd web server with PHP5 support using MySQL backend</title>
		<link>http://www.debiantutorials.com/install-lighttpd-web-server-with-php5-support-using-mysql-backend/</link>
		<comments>http://www.debiantutorials.com/install-lighttpd-web-server-with-php5-support-using-mysql-backend/#comments</comments>
		<pubDate>Sun, 03 Feb 2008 22:29:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[lighttpd]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://debiantutorials.net/install-lighttpd-web-server-with-php5-support-using-mysql-backend/</guid>
		<description><![CDATA[Lighttpd is a web server which is designed to be secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments. Its low memory footprint (compared to other web servers), light CPU load and its speed goals make lighttpd suitable for servers that are suffering load problems, or for serving static media separately from dynamic [...]]]></description>
			<content:encoded><![CDATA[<p>Lighttpd is a web server which is designed to be secure, fast, standards-compliant, and flexible while being optimized for speed-critical environments. Its low memory footprint (compared to other web servers), light CPU load and its speed goals make lighttpd suitable for servers that are suffering load problems, or for serving static media separately from dynamic content. lighttpd is free software / open source, and is distributed under the BSD license.</p>
<p>In this tutorial you will be guided through the installation process and to configure the web server to use MySQL backend.<span id="more-5"></span></p>
<p>First install the lighttpd package and the MySQL backend module<br />
<code>apt-get install lighttpd lighttpd-mod-mysql-vhost<br />
</code></p>
<p>Create a MySQL database, table and insert some sample data<br />
<code>mysql -u root -p<br />
&nbsp;<br />
GRANT SELECT ON lighttpd.* TO vhosts@localhost IDENTIFIED BY 'mypasswd';<br />
FLUSH PRIVILEGES;<br />
CREATE DATABASE lighttpd;<br />
USE lighttpd;<br />
&nbsp;<br />
CREATE TABLE vhosts (<br />
domain varchar(64) NOT NULL PRIMARY KEY,<br />
docroot varchar(128) NOT NULL<br />
);<br />
&nbsp;<br />
INSERT INTO vhosts VALUES ('test.com','/var/www/test.com/');<br />
INSERT INTO vhosts VALUES ('www.test.com','/var/www/test.com/');<br />
&nbsp;<br />
quit;<br />
</code></p>
<p>Create a configuration file for the mysql backend (pico /etc/lighttpd/conf-available/10-mysql-vhost.conf). Add the following lines:<br />
<code>server.modules += ( "mod_mysql_vhost" )<br />
&nbsp;<br />
mysql-vhost.db = "lighttpd"<br />
mysql-vhost.user = "vhosts"<br />
mysql-vhost.pass = "mypasswd"<br />
mysql-vhost.sock = "/var/run/mysqld/mysqld.sock"<br />
mysql-vhost.sql = "SELECT docroot FROM vhosts WHERE domain='?';"<br />
</code></p>
<p>Make sure you change the db, user and pass variables to a valid mysql user and database on the local server.</p>
<p>Enable the mysql backend module<br />
<code>ln /etc/lighttpd/conf-available/10-mysql-vhost.conf /etc/lighttpd/conf-enabled/10-mysql-vhost.conf<br />
</code></p>
<p>Install PHP5 packages<br />
<code>apt-get install php5-cgi php5-mysql php5-gd php5-imagick php5-imap php5-mcrypt php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl<br />
</code></p>
<p>Configure PHP5 to display correct values for PATH_INFO and PHP_SELF (pico /etc/php5/cgi/php.ini). Change the following variable found in your php.ini file:<br />
<code>cgi.fix_pathinfo = 1<br />
</code></p>
<p>Configure fastcgi to use PHP5 insted of the default PHP4 (pico /etc/lighttpd/conf-available/10-fastcgi.conf)<br />
<code>"bin-path" =&gt; "/usr/bin/php5-cgi",<br />
</code></p>
<p>Enable fastcgi/PHP5:<br />
<code>ln /etc/lighttpd/conf-available/10-fastcgi.conf /etc/lighttpd/conf-enabled/10-fastcgi.conf<br />
</code></p>
<p>Restart the lighttpd web server:<br />
<code>/etc/init.d/lighttpd restart<br />
</code></p>
<p>Now you're all set and you should be able to browse to test.com. (make sure the host exists in DNS or has been placed in your local hosts file)</p>
<p>Lighttpd caches the vhost configurations until next restart so you'll have to restart lighttpd everytime a change is made in the MySQL database.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.debiantutorials.com/install-lighttpd-web-server-with-php5-support-using-mysql-backend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
