Introduction
lighttpd is one of the best in many opensource lightweight Web servers. Support FastCGI, CGI, Auth, output compression (outputs compress), URL rewriting, alias and other important functions.
[Edit]Lighttpd
sudo apt-get install lighttpd #安装lighttpd
After installation, the system will automatically start LIGHTTPD, open http://localhost is, if you have previously installed Apache, the default home page is replaced by http://localhost/index.lighttpd.html.
The root directory of the Web server is in/var/www/, and the configuration file is in/etc/lighttpd/lighttpd.conf.
command to restart LIGHTTPD
[Edit]Enable user Directory
When the user directory is enabled, each user's home directory has a web directory of its own. Command:
sudo lighttpd-enable-mod userdir
Reload Configuration
sudo service lighttpd Reload
Users can now place files in the public_html folder in the home directory. For example, QII users need to put files to/home/joe/public_html, open http://loaclhost/~qii
[Edit]PHP
Installing php5-cgi
sudo apt-get install php5-cgi
Enable fastcgi:
sudo lighttpd-enable-mod fastcgi
Reload configuration:
sudo service lighttpd Reload
Create, Test phpinfo:
sudo vi/var/www/info.php
<?php phpinfo ();?>
Open http://localhost/info.php.
[Edit]Installing Zend Optimizer
PHP version 5.2 is required, do not support Ubuntu10.04 PHP5.3, please refer to PHP5.2.
Download Zend Optimizer. Direct paste, reference version number change (this is 32-bit), otherwise the homepage to register to under
Tar zxvf zendoptimizer-3.3.9-linux-glibc23-i386.tar.gz
Edit PHP.ini
sudo gedit/etc/php5/cgi/php.ini
Start by adding, pay attention to punctuation to English.
[Zend optimizer]zend_optimizer.optimization_level=1 zend_extension= "/usr/local/zend/zendoptimizer.so"
Restart LIGHTTPD
Or the Phpinfo file above, you can see the following information
This program makes use of the Zend Scripting Language engine:zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
[Edit]Installation XCache
sudo apt-get install Php5-xcache
[Email protected]:/home/qii# dpkg-l | grep xcachii php5-xcache 1.2.2-5 Fast, stable PHP opcode Cacher
The XCache configuration file path is
/etc/php5/conf.d/xcache.ini
Edit PHP.ini
sudo gedit/etc/php5/cgi/php.ini
Add the contents of Xcache.ini to php.ini. Restart LIGHTTPD
SUDO/ETC/INIT.D/LIGHTTPD restart
Check if the installation was successful
[Email protected]:/home/qii# php-vphp 5.2.10-2ubuntu6 with Suhosin-patch 0.9.7 (CLI) (built:oct 16:30:10) Copyri Ght (c) 1997-2009 the PHP groupzend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies with XCache v1.2.2, Copyr Ight (c) 2005-2007, by MOo
There should be a XCache module on the front info.php page.
XCache Module for info page |
A bit strange here is that if you do not add the contents of the Xcache.ini Php.ini,apache can also be loaded into XCache, but info.php on the XCache module.
[Edit]Installing Eaccelerator
sudo apt-get install Php5-dev
Download Eaccelerator
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
Tar jxvf eaccelerator-0.9.6.1.tar.bz2
Phpizesudo./configure-enable-eaccelerator=sharedsudo make
[Email protected]:~/tmp/eaccelerator-0.9.6.1$ sudo make installinstalling shared extensions: /usr/lib/php5/ 20060613+lfs/
Modify the php.ini file, install it as a zend extension, preferably at the beginning, before [Zend], and avoid the puzzling problem:
sudo vi/etc/php5/cgi/php.ini
[eaccelerator]zend_extension= "/usr/lib/php5/20060613+lfs/eaccelerator.so" eaccelerator.shm_size= "16" Eaccelerator.cache_dir= "/tmp/eaccelerator" eaccelerator.enable= "1" eaccelerator.optimizer= "1" eaccelerator.check_ Mtime= "1" eaccelerator.debug= "0" eaccelerator.filter= "" eaccelerator.shm_max= "0" eaccelerator.shm_ttl= "0" eaccelerator.shm_prune_period= "0" eaccelerator.shm_only= "0" eaccelerator.compress= "1" eaccelerator.compress_level = "9" eaccelerator.allowed_admin_path= "/var/www/control.php"
Create a cache directory
Eaccelerator.cache_dir= "/var/cache/eaccelerator" here defines the cache path
The default value is/tmp/eaccelerator, which is very simple because anyone can write to the directory, but it is not advisable, because the system automatically cleans up the directory after a reboot. A better place is the/var/cache/eaccelerator. Create the directory and make sure that it is writable to the consumer of eaccelerator (usually the user is your network server runner, possibly Www-data). Continue with the default values:
Mkdir/tmp/eaccelerator
chmod 777/tmp/eaccelerator
Change to/var/cache/eaccelerator words so continue, first change php.ini
sudo mkdir/var/cache/eacceleratorsudo chown root:www-data/var/cache/eacceleratorsudo chmod u=rwx,g=rwx,o=/var/cache /eaccelerator
Copy the control file control.php to the Web site root directory
sudo cp control.php/var/www/
Modify control.php $user and $PW, default is admin and Eaccelerator
Restart LIGHTTPD
SUDO/ETC/INIT.D/LIGHTTPD restart
Open http://localhost/control.php
Eaccelerator control.php Page |
To view the previous Info.php page, the following fields are available:
This program makes use of the Zend Scripting Language engine:zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies With eaccelerator v0.9.6.1, Copyright (c) 2004-2010 eaccelerator, by Eaccelerator
[Edit]Ror+mysql[Edit]installation
sudo apt-get install mysql-server mysql-client #中途需要输入root用户密码
sudo gem install rails
sudo apt-get Install
Ubuntu Installation lighttpd