Centos-5 Yum install nginx-mysql5.1-php5.2-fastcgi build lnmp Server

Source: Internet
Author: User
Import third-party software libraries

Centos 5 32-bit:

  1. Rpm-uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm
  2. Rpm-uvh http://centos.alt.ru/repository/centos/5/i386/centalt-release-5-3.noarch.rpm

Centos 5 64-bit:

  1. Rpm-uvh http://nginx.org/packages/centos/5/noarch/RPMS/nginx-release-centos-5-0.el5.ngx.noarch.rpm
  2. Rpm-uvh http://centos.alt.ru/repository/centos/5/x86_64/centalt-release-5-3.noarch.rpm
Install MySQL

1. Uninstall the built-in Apache, and then update the software library.

  1. Yum remove httpd
  2. Yum update

Install MySql in yum

  1. Yum install MySQL mysql-Server

Add the startup Item and start MySQL

  1. Chkconfig -- levels 235 mysqld on
  2. /Etc/init. d/mysqld start

Set the MySQL password and related settings

  1. Mysql_secure_installation

Because this command is started for the first time, press Enter next, enter your MySQL password, and follow the prompts.

Install nginx

1. Install nginx in yum

  1. Yum install nginx

Add to startup Item and start nginx

  1. Chkconfig -- levels 235 nginx on
  2. /Etc/init. d/nginx start
Install PHP

1. install PHP and related modules

  1. Yum install PHP-fpm php-cli PHP-mysql PHP-Gd PHP-imap PHP-ldap php-odbc php-pear PHP-xml php-xmlrpc php-mbstring PHP-mcrypt PHP- mssql php-snmp php-soap PHP-tidy

2. Edit the php. ini file and add CGI. fix_pathinfo = 1 at the end of the file.

3. Start PHP-FPM

  1. Service PHP-FPM start

Add PHP-FPM to the startup Item

  1. Chkconfig -- levels 235 PHP-FPM on
Modify the nginx configuration file and add FastCGI support

1. Modify the nginx. conf file
VI/etc/nginx. conf
Configuration File Code:

  1. [...]
  2. Server {
  3. Listen 80;
  4. SERVER_NAME _;
  5. # Charset koi8-r;
  6. # Access_log logs/host. Access. Log main;
  7. Location /{
  8. Root/usr/share/nginx/html;
  9. Index index. php index.html index.htm;
  10. }
  11. Error_page 404/404 .html;
  12. Location =/404.html {
  13. Root/usr/share/nginx/html;
  14. }
  15. # Redirect server error pages to the static page/50x.html
  16. #
  17. Error_page 500 502 503 x.html;
  18. Location =/50x.html {
  19. Root/usr/share/nginx/html;
  20. }
  21. # Proxy the PHP scripts to Apache listening on 127.0.0.1: 80
  22. #
  23. # Location ~ \. Php $ {
  24. # Proxy_pass http: // 127.0.0.1;
  25. #}
  26.  
  27. # Pass the PHP scripts to FastCGI server listening on Fig: 9000
  28. #
  29. Location ~ \. Php $ {
  30. Root/usr/share/nginx/html;
  31. Fastcgi_pass 127.0.0.1: 9000;
  32. Fastcgi_index index. php;
  33. Fastcgi_param script_filename/usr/share/nginx/html $ fastcgi_script_name;
  34. Include fastcgi_params;
  35. }
  36. # Deny access to. htaccess files, if Apache's document root
  37. # Concurs with nginx's one
  38. #
  39. Location ~ /\. Ht {
  40. Deny all;
  41. }
  42. }
  43. [...]

Modify row 33/usr/share/nginx/html to your website root directory.
2. Restart nginx PHP-FPM

  1. /Etc/init. d/nginx restart
  2. /Etc/init. d/PHP-FPM restart

Test...

Source: http://www.centos.bz/2011/03/yum-install-nginx-mysql-php-fastcgi-lnmp/

 

Related Article

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.