Recently, all the original programs have been migrated to nginx, and Ubuntu has been used for a while. I am getting used to the Linux operations. In addition, the performance of Linux is really good, the configuration starts.
Configured
Ubuntu 9.10 nginx 0.7.62 php5.2.10 MySQL 5.1.37
0. Open the terminal and switch to root.
Sudo-H-S
1. Install PhP5
Apt-Get install PHP-pear php5-cli php5-common php5-xcache php5-cgi php5-mysql php5-gd php5-dev php5-memcache
Install it by default.
2. Install mysql5
Apt-Get install mysql-server mysql-client libipc-sharedcache-perl mysql-doc-5.0 tinyca
Enter and confirm the MySQL password during installation. Remember the password after setting
3. Install nginx
Apt-Get install nginx
Version 0.7.62
4. install PHP-FastCGI to download PHP-FastCGI, decompress the package, and install it (this will be provided in the downloaded package)
Tar-zxvf php-fastcgi.tar.gzcd/tmp/PHP-FastCGI/
CP init-FastCGI/etc/init. d/init-FastCGI
Chmod 755/etc/init. d/init-FastCGI
Cp php-FastCGI/usr/bin/PHP-FastCGI
CP spawn-fcgi/usr/bin/spawn-fcgi
5.install zenddownload zend.tar.gz (available in the download package)
Tar zxvf zend.tar.gz
CP-r Zend/usr/local/nano/etc/PhP5/cgi/PHP. ini
Copy the following to the bottom of the php. ini file
[Zend]
Zend_extension_manager.optimizer =/usr/local/Zend/lib/Optimizer-3.3.3/php-5.2.x/zendoptimizer. So
Zend_extension_manager.optimizer_ts =/usr/local/Zend/lib/Optimizer_TS-3.3.3/zendoptimizer. So
Zend_optimizer.version = 3.3.3zend _ extension =/usr/local/Zend/lib/zendextensionmanager. So
Zend_extension_ts =/usr/local/Zend/lib/zendextensionmanager_ts.so
6. Test the PHP-CGI run:
/Etc/init. d/init-FastCGI startps-Ef | grep PHP
The result is as follows:
7. Modify the nginx configuration file (copy the following code and run it on the terminal)
Nano/etc/nginx/sites-available/Default
Find the homepage file with index. php as the top priority.
Location /{
Root/var/www/nginx-default;
Index index. php index.html index.htm;
}
Fastcgilocation
~ \. Php $
{
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename/var/www/nginx-default $ fastcgi_script_name; Include/etc/nginx/fastcgi_params;
}
Restart nginx (run the following code on the terminal)/etc/init. d/nginx restart
In the/var/www/nginx-default/directory, create info. php with the following content:
<? PHP
Phpinfo ();
?>
Then access http: // localhost/info. if PHP is correctly displayed, it may be an internal error of 500 or a 400 error. The error code is that FastCGI is not correctly set. Pay attention to the above path and configuration file.
8. Set Directory Access Permissions
9. Set boot start: in the upper left corner of the page, choose system> preference> start the program, and click Add:
Name: PHP-CGI
Command:/etc/init. d/init-FastCGI
10. The configuration is complete. Click to download the package
Author: Yang xinqi
References: http://www.7qy.com/article/linux/linux_nginx.html