1 minutes Perfect installation of the latest centos+nginx+php-fpm+mysql_php tutorials

Source: Internet
Author: User
Tags apc gpg mcrypt pear tidy vars epel repo
PHP 5.3.1

MySQL 5.0.89

Nginx 0.8.33 or 0.7.65 (optional)

Now we can quickly automate the installation of CentOS + Nginx + php-fpm + MySQL

This is much better than the online one-button installation package, highly recommended for all novices and pros

My server on the full use of the source code compiled installation, but also not good where to go, but also laborious

I'm finished with some of the usual extensions for PHP, Pdo,eaccelerator,memcache,tidy, etc.

Create a new repo first

  
   
   

Put in the following content

 
  
  
  1. [21andy.com]
  2. strong> name = 21andy . com Packages for Enterprise Linux 5-$basearch
  3. baseurl = http :// www.21andy.com/centos/5/$basearch/
  4. Enabled = 1
  5. gpgcheck = 0
  6. protect = 1

Enable EPEL Repo

I386

 
  
  
  1. Rpm-ihv

x86_64

 
  
  
  1. Rpm-ihv
  2. http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

Then import key

 
  
  
  1. RPM--import/etc/pki/rpm-gpg/rpm-gpg-key-epel

OK, one-click Installation

 
  
  
  1. # yum Install Nginx php-fpm mysql-server

If nginx you want to use 0.7.65 the latest stable version, the yum-y install Nginx replaced yum-y install nginx-stable can be

More Complete Installation

 
  
  
  1. Yum-y Update
  2. Yum-y Mysql-server
  3. Service mysqld Start
  4. mysqladmin-u Root Password root
  5. Service Mysqld Stop
  6. Yum-y Install Nginx PHP-FPM
  7. PHP-CLI php-pdo php-mysql Php-mcrypt php-mbstring
  8. PHP-GD Php-tidy Php-xml Php-xmlrpc
  9. Php-pear Php-pecl-memcache Php-eaccelerator
  10. # APC and Eaccelerator conflict, 2 Select 1
  11. Yum-y Install PHP-PECL-APC

Look at my complete installation, just one sentence

Yum-y install Nginx mysql-server php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml PHP-XM LRPC php-pear Php-pecl-memcache Php-eaccelerator

Installation results, fully automatic

 
 
  1. Dependencies Resolved
  2. ==========================================================
  3. Package Arch Version Repository Size
  4. ==========================================================
  5. Installing:
  6. MySQL x86_64 5.0.89-1.el5 21andy.com 3.5 M
  7. Mysql-server x86_64 5.0.89-1.el5 21andy.com M
  8. Nginx x86_64 0.8.33-3.el5 21andy.com 422 k
  9. PHP-CLI x86_64 5.3.1-2.el5 21andy.com 2.4 M
  10. Php-eaccelerator x86_64 2:0.9.6-1.el5 21andy.com 118 k
  11. PHP-FPM x86_64 5.3.1-2.el5 21andy.com 1.2 M
  12. PHP-GD x86_64 5.3.1-2.el5 21andy.com k
  13. Php-mbstring x86_64 5.3.1-2.el5 21andy.com 1.1 M
  14. Php-mcrypt x86_64 5.3.1-2.el5 21andy.com k
  15. Php-mysql x86_64 5.3.1-2.el5 21andy.com k
  16. Php-pdo x86_64 5.3.1-2.el5 21andy.com-K
  17. Php-pear Noarch 1:1.9.0-1.el5 21andy.com 420 k
  18. Php-pecl-memcache x86_64 2.2.5-3.el5 21andy.com-K
  19. Php-tidy x86_64 5.3.1-2.el5 21andy.com k
  20. Php-xml x86_64 5.3.1-2.el5 21andy.com-K
  21. Php-xmlrpc x86_64 5.3.1-2.el5 21andy.com-K
  22. Installing for dependencies:
  23. GMP x86_64 4.1.4-10.EL5 Base 201 k
  24. Libxaw x86_64 1.0.2-8.1 Base 329 k
  25. LIBXMU x86_64 1.0.2-5 base + k
  26. LIBXPM x86_64 3.5.5-3 Base K
  27. Libedit x86_64 2.11-2.20080712cvs.el5 Epel k
  28. Libmcrypt x86_64 2.5.8-4.el5.centos Extras k
  29. Libtidy x86_64 0.99.0-14.20070615.el5 Epel k
  30. Php-common x86_64 5.3.1-2.el5 21andy.com 554 k
  31. Sqlite2 x86_64 2.8.17-5.el5 21andy.com 165 k
  32. T1lib x86_64 5.1.1-7.el5 Epel 208 k
  33. Updating for dependencies:
  34. Libevent x86_64 1.4.12-1.el5 21andy.com 129 k
  35. Transaction Summary
  36. ==========================================================
  37. Install the package (s)
  38. Update 1 package (s)
  39. Remove 0 Package (s

Finally, as long as yum-y update , it's all up to date.

Don't forget to start the boot

 
  
  
  1. Chkconfig--level 345 mysqld on
  2. Chkconfig--level 345 php-fpm on
  3. Chkconfig--level 345 Nginx on

Take a look at the powerful results I've tested with virtual machines.

Http://www.21andy.com/blog/20100219/1703.html

Add: All the configuration files are in/etc directory, including Nginx, PHP-FPM, mysql configuration file, please find the settings yourself, the following is my Nginx configuration example

Create a new /www directory, and the site and logs are all here.

Don't forget to build the log directory, you access_log in the configuration file /www/logs

Note: Fastcgi_params to join this line

# Vim/etc/nginx/fastcgi_params

  
   
 
  1. Fastcgi_param script_filename $document _root$fastcgi_script_name;

# vi/etc/nginx/nginx.conf

 
 
  1. User nobody nobody;
  2. Worker_processes 8; #这里根据你的CPU和内存配置, set 2 to 10 OK
  3. Error_log /www/logs/nginx_error.log Crit;
  4. Pid/usr/local/nginx/logs/nginx.pid;
  5. #Specifies The value for maximum file descriptors that can is opened by the this process.
  6. Worker_rlimit_nofile 51200;
  7. Events {
  8. Use Epoll;
  9. Worker_connections 51200;
  10. }
  11. HTTP {
  12. include mime.types;
  13. Default_type Application/octet-stream;
  14. #charse gb2312; # default encoding, can not be set
  15. Server_names_hash_bucket_size 128;
  16. Client_header_buffer_size 16k;
  17. Large_client_header_buffers 4 16k;
  18. Client_max_body_size 8m;
  19. Sendfile on;
  20. Tcp_nopush on;
  21. Keepalive_timeout 60;
  22. Tcp_nodelay on;
  23. Fastcgi_connect_timeout 300;
  24. Fastcgi_send_timeout 300;
  25. Fastcgi_read_timeout 300;
  26. Fastcgi_buffer_size 64k;
  27. Fastcgi_buffers 4 64k;
  28. Fastcgi_busy_buffers_size 128k;
  29. Fastcgi_temp_file_write_size 128k;
  30. gzip on;
  31. Gzip_min_length 1k;
  32. Gzip_buffers 4 16k;
  33. Gzip_http_version 1.0;
  34. Gzip_comp_level 5;
  35. Gzip_types text/plain text/javascript application/x-javascript text/css application/xml;
  36. Gzip_vary on;
  37. #limit_zone crawler $binary _remote_addr 10m;
  38. server {
  39. Listen 80;
  40. server_name localhost;
  41. root/www;
  42. Location/status {
  43. Stub_status on;
  44. Access_log off;
  45. }
  46. Location/{
  47. # Here's all the files and directories that don't exist, all transferred to index.php processing
  48. Try_files $uri $uri//index.php?q=$uri&$args;
  49. }
  50. # This place is divided into server.conf is to open the server again convenient, unified call, put into the/etc/nginx/directory
  51. include server.conf;
  52. Log_format Access ' $remote _addr-$remote _user [$time _local] "$request" '
  53. ' $status $body _bytes_sent ' $http _referer '
  54. ' "$http _user_agent $http _x_forwarded_for ' ;
  55. Access_log/www/logs/access.log access;
  56. }
  57. server {
  58. Listen 80;
  59. server_name www.21andy.com 21andy.com *.21andy.com;
  60. root/www/21andy.com;
  61. if ($host !~* 21andy.com$) {
  62. return 444;
  63. }
  64. Location/{
  65. Try_files $uri $uri//index.php?q=$uri&$args;
  66. }
  67. include server.conf; # It's been reused here, it's saved.
  68. Access_log/www/logs/21andy.com_access.log access;
  69. }
  70. }

# vi/etc/nginx/server.conf

 
 
  1. Index index.html index.htm index.php;
  2. #limit_conn crawler 20;
  3. Location ~/.ht {
  4. Deny all;
  5. }
  6. Location ~. *. (SQLITE|SQ3) $ {
  7. Deny all;
  8. }
  9. Location ~. *.php$ {
  10. Fastcgi_pass Unix:/tmp/php-cgi.sock;
  11. #fastcgi_pass 127.0.0.1:9000;
  12. Fastcgi_index index.php;
  13. include Fastcgi_params;
  14. }
  15. Location ~. *. (Gif|jpg|jpeg|png|bmp|swf|ico) $ {
  16. Expires 30d;
  17. Access_log off;
  18. }
  19. Location ~. *. (JS|CSS)? $ {
  20. Expires 30d;
  21. Access_log off;
  22. }

We can skip the following content

PHP-FPM can also be used with the following settings, but it is recommended to use the above, more stable

 
  
  
  1. Location ~. php$ {
  2. Root /www;
  3. Fastcgi_pass 127.0.0.1:9000;
  4. Fastcgi_index index.php;
  5. #下面这一行要加在/etc/nginx/fastcgi_params.
  6. #fastcgi_param script_filename $document _root$fastcgi _script_name ;
  7. include fastcgi_params;

Whether using the Php-cgi.sock or 9000 port method, Nginx and PHP-FPM are set to the same

Nginx settings have been mentioned above, remember to modify the php-fpm.conf corresponding place

# vi/etc/php-fpm.conf

 
  
   
  127.0.0.1:9000
 
  

Or

 
  
   
  Unix:/tmp/php-cgi.sock
 
  

Original Address: http://www.21andy.com/blog/20100219/1701.html


http://www.bkjia.com/PHPjc/445841.html www.bkjia.com true http://www.bkjia.com/PHPjc/445841.html techarticle PHP 5.3.1 MySQL 5.0.89 nginx 0.8.33 or 0.7.65 (optional) Now, we can quickly fully automated CentOS + Nginx + php-fpm + MySQL installed this can be compared to the online what a button. .

  • 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.