Lighttpd is a secure, fast, and standard compatibility WEB service designed for high-load environments. This tutorial introduces how to install and configure lighttpd + php5 (fastcgi mode) + MYSQL on the Fedora7 server. 1. Set the mysql root Password to test and change it as needed. 2. Install MySQL5.0. First, install MySQL5.0: yuminstallm.
Lighttpd is a secure, fast, and standard compatibility WEB service designed for high-load environments. This tutorial describes how to install and configure lighttpd + php5 (fastcgi mode) + MYSQL on the Fedora 7 server.
1. Statement before start
Set the mysql root Password to test and change it as needed.
2. Install MySQL 5.0
First, install MySQL 5.0:
Yum install mysql-serve
Then we create a system startup link for MySQL (MySQL is automatically started when the system is running) and start the MySQL service:
Chkconfig -- levels 235 mysqld on
/Etc/init. d/mysqld start
Create a password for the MySQL root User (replace phpvcn with your password ):
Mysqladmin-u root password phpvcn
Check if mysql is started.
Netstat-tap | grep mysql
If the following information is output, MySQL is listening:
Tcp 0 0 localhost. server1: mysql *: * LISTEN 2713/mysqld
That is to say, before you set a security password, MySQL only listens to localhost. server1 (that is to say, only connections from the local machine are allowed), but if the output is as follows:
Tcp 0 0 *: mysql *: * LISTEN 2713/mysqld
You have to set a password for your MySQL immediately, because now everyone can access your database and modify the data at will:
Mysqladmin-h server1.itbbs.cn-u root password phpvcn
3. Install Lighttpd
Lighttpd is a package of Fedora, which is easy to install:
Yum install lighttpd
Create a system startup link and start the lighttpd service:
Chkconfig -- levels 235 lighttpd on
/Etc/init. d/lighttpd start
Now open http: // 192.168.0.100 in your browser and you will be able to see the default lighttpd activation page:
/Etc/lighttpd. conf, add "mod_fastcgi" to server. modules ":
Vi/etc/lighttpd. conf
[...] Server. modules = (# "mod_rewrite", # "mod_redirect", # "mod_alias", "mod_access", # "mod_cmc", # "mod_trigger_b4_dl", # "mod_auth ", # "mod_status", # "mod_setenv", "mod_fastcgi", # "mod_proxy", # "mod_simple_vhost", # "mod_evhost", # "mod_userdir", # "mod_cgi ", # "mod_compress", # "mod_ssi", # "mod_usertrack", # "mod_expire", # "mod_secdownload", # "mod_rrdtool", "mod_accesslog") [...]
Next, look down and add the following in fastcgi. server:
[...] #### Fastcgi module ## read fastcgi.txt for more info ## for PHP don't forget to set cgi. fix_pathinfo = 1 in the php. inifastcgi. server = (". php "=> (" localhost "=> (" socket "=>"/var/run/lighttpd/php-fastcgi.socket ", "bin-path" => "/usr/bin/php-cgi") [...]
Then restart Lighttpd:
/Etc/init. d/lighttpd restart
6. Test the installation details of PHP5/
By default, the root document directory of the website on the server is/srv/www/lighttpd. Now we create a famous PHP file-info. php In this directory and check the result in the browser.
The PHPINO page contains many details about PHP installation, such as the PHP version and the extension library installation.
Vi/srv/www/lighttpd/info. php
Open your browser and enter http: // 192.168.0.100/info. php in the address bar:
Annex 2185
On the Server API line, we can see that PHP5 is working normally in FastCGI mode. pull down the scroll bar and see what extension components are loaded. however, MySQL has not been loaded into PHP 5 yet.
7. Make PHP5 support MySQL
Adding MySQL support to PHP is also very easy! Install the php-mysql package. You can also install other PHP5 extensions as follows:
Yum install php-mysql
Search for something related to PHP?
Yum search php
Install some common extensions:
Yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
Okay, restart Lighttpd again:
/Etc/init. d/lighttpd restart
Success! Refresh the browser. The MYSQL module has already been installed: