Build Nginx + PHP5 + MySQL5 platform under Ubuntu9.04

Source: Internet
Author: User
To build the Nginx + PHP5 + MySQL5 platform under Ubuntu9.04. 1. Install the PHP5 terminal and execute the following code: (do not turn off the terminal) apt-getinstallphp-pearphp5-cliphp5-commonphp5-xcachephp5-cgiphp5-mysqlphp5-gdphp5-devphp5-memcache default installation on line 2. Install mysql5 (copy the following

Take notes on setting up the Nginx + PHP5 + MySQL5 platform in Ubuntu 9.04.

1. Install PHP5
Terminal: (do not close the Terminal)
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 (copy the following code and run it on the terminal)
Apt-get install mysql-server mysql-client libipc-sharedcache-perl mysql-doc-5.0 tinyca
Prompt for mysql password and confirm during installation

3. Install nginx (copy the following code and run it on the terminal)
Apt-get install nginx

4. install php-fastcgi (copy the following code and run it on the terminal. Each line is executed separately)
First download php-fastcgi.tar.gz and then upload it to the tmp directory with winscp

Cd/tmp/
After the download is complete, decompress and install: (copy the following code and run it on the terminal)
Tar-zxvf php-fastcgi.tar.gz

Cd/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. Test the PHP-CGI run: (copy the following code to run under the terminal, each line is executed separately)
/Etc/init. d/init-fastcgi start

Ps-ef | grep php

The following shows the running status.
Www-data 8411 1 0 21:31? 00:00:00/usr/bin/php5-cgi
Www-data 8413 8411 0? 00:00:00/usr/bin/php5-cgi
Www-data 8414 8411 0? 00:00:00/usr/bin/php5-cgi
Www-data 8415 8411 0? 00:00:00/usr/bin/php5-cgi
Www-data 8416 8411 0? 00:00:00/usr/bin/php5-cgi
Www-data 8417 8411 0? 00:00:00/usr/bin/php5-cgi
Root 8419 8330 0 00:00:00 pts/0 grep php

6. Modify the nginx configuration file (copy the following code and run it on the terminal)
Gedit/etc/nginx/sites-available/default

Change the CIDR Block similar to the following

This section uses index. php as the top homepage File
Location /{
Root/var/www/nginx-default;
Index. php index.html index.htm;
}

Fastcgi
Location ~ \. 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;

}

The red part is modified. Note that

7. Restart nginx (copy the following code and run it on the terminal)
/Etc/init. d/nginx restart

In the/var/www/nginx-default/directory, create info. php with the following content:
Phpinfo ()
?>
Then access http: // localhost/info. php and it will be displayed successfully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.