Author: Yang xinqi
RecentlyProgramAll of them have been migrated to nginx, and Ubuntu has been used for a while, so I am getting used to the Linux operations. In addition, the Linux performance is really good, so I started to configure it.
Configured
Ubuntu 9.10 nginx 0.7.62 php5.2.10 MySQL 5.1.37
For more information Article Finally configured the successful Article address: http://www.7qy.com/article/linux/linux_nginx.html0.open the terminal to switch to rootsudo-H-S1. install PHP5apt-get install PHP-pear php5-cli php5-common php5-xcache php5-cgi php5-mysql php5-gd php5-dev default installation on line 2. install mysql5apt-get install mysql-server mysql-client libipc-sharedcache-perl mysql-doc-5.0 tinyca prompts to enter the MySQL password during installation and confirm, remember the password after setting 3. install nginx apt-Get install nginx version 0.7.624. install PHP-FastCGI and download PHP-FastCGI. After the installation is complete, decompress and install the tool (this will be provided in the downloaded package) tar-zxvf php-fastcgi.tar.gzcd/tmp/PHP-FastCGI/CP init-FastCGI/etc/init. d/init-fastcgichmod 755/etc/init. d/init-fastcgicp PHP-FastCGI/usr/bin/PHP-fastcgicp spawn-fcgi/usr/bin/spawn-fcgi5.install zendto download zend.tar.gz (provided in the download package) tar zxvf zend.tar.gz CP-r Zend/usr/local/nano/etc/PhP5/cgi/PHP. INI copy the following to PhP. INI file bottom [Zend] zend_extension_manager.optimizer =/usr/local/Zend/lib/Optimizer-3.3.3/php-5.2.x/zendoptimizer. sozend_extension_manager.optimizer_ts =/usr/local/Zend/lib/Optimizer_TS-3.3.3/zendoptimizer. sozend_optimizer.version = 3.3.3zend _ extension =/usr/local/Zend/lib/zendextensionmanager. sozend_extension_ts =/usr/local/Zend/lib/zendextensionmanager_ts.so6. test PHP-CGI run:/etc/init. d/init-FastCGI startps-Ef | grep PHP result: 7. modify the nginx configuration file (copy the following Code Run the following command on the terminal: Nano/etc/nginx/sites-available/default. PHP is the top homepage File Location/{root/var/www/nginx-default; 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 (copy the following code to run on the terminal) /etc/init. d/nginx restart create info in the/var/www/nginx-default/directory. PHP content: <? Phpphpinfo ()?> Then access http: // localhost/info. if PHP is correctly displayed, it may be an internal error of 500 or a 400 error. The error 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, choose system> preference> start the program, and click Add: Name: PHP-cgi Command:/etc/init. d/init-fastcgi10. the running result is as follows. Click to download the Zend and PHP FastCGI packages.
Reference to buy drunk Eldest Brother's article, finally configured successful Article address: http://www.7qy.com/article/linux/linux_nginx.html
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 running result is as follows:
Now, click Download package.