1 minutes Perfect installation of the latest Centos+nginx+php-fpm+mysql

Source: Internet
Author: User
Tags apc gpg install php mcrypt pear tidy

PHP 5.3.1MySQL5.0.89Nginx0.8.33 or 0.7.65(optional) Now we can quickly automate the CentOS+ Nginx + php-fpm +MySQLinstalled this can be more than the online spread of what a key installation package is much better, highly recommended this method of installation, suitable for all rookie and master of my server on the full use of the source code compiled installation, it is not good to go, but also a lot of effort I have already included some common extensions of PHP, Pdo,eaccelerator,memcache,Tidy, wait, start a new repo .#Vi/etc/yum.repos.d/centos.21andy.com.repoAdd the following [21Andy.com] name=21andy.com Packages forEnterprise Linux 5-$basearchBaseURL=http://www.21andy.com/centos/5/$basearch/Enabled=1Gpgcheck=0Protect=1Enable EPEL repoi386rpm-IHV http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpmx86_64rpm-IHV http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpmthen import keyrpm--import/etc/pki/rpm-gpg/rpm-gpg-KEY-EPEL OK, one-click Installation#Yum install nginx php-fpm mysql-serverIf nginx you want to use 0.7.65 the latest stable version, the yum-y install Nginx replaced yum-y install nginx-stable will be able to install Yum in a more complete-y update Yum-YMySQL-Server service mysqld start mysqladmin-u root password root service mysqld stop Yum-Y install Nginx php-fpm PHP-CLI Php-pdo php-MySQLPhp-mcrypt php-mbstring PHP-GD Php-tidy Php-xml php-xmlrpc PHP-pear Php-pecl-memcache php-Eaccelerator#APC and Eaccelerator conflict, 2 Select 1Yum-y Install php-pecl-APC Look at my complete installation, just a yum-Y Install NginxMySQL-server php-fpm php-cli php-pdo php-MySQLPhp-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-Eaccelerator installation results, fully automatic dependencies resolved==========================================================Package Arch Version Repository Size==========================================================Installing:MySQLx86_64 5.0.89-1.el5 21andy.com 3.5MMySQL-server x86_64 5.0.89-1.el5 21andy.com 10M nginx x86_640.8.33-3.el5 21andy.com 422k PHP-CLI x86_64 5.3.1-2.el5 21andy.com 2.4M PHP-eaccelerator x86_64 2:0.9.6-1.el5 21andy.com 118k PHP-FPM x86_64 5.3.1-2.el5 21andy.com 1.2M PHP-GD x86_64 5.3.1-2.el5 21andy.com 110k PHP-mbstring x86_64 5.3.1-2.EL5 21andy.com 1.1M PHP-mcrypt x86_64 5.3.1-2.el5 21andy.com 27k PHP-MySQLx86_64 5.3.1-2.el5 21andy.com 84k PHP-pdo x86_64 5.3.1-2.el5 21andy.com 91k PHP-pear Noarch 1:1.9.0-1.el5 21andy.com 420k PHP-pecl-memcache x86_64 2.2.5-3.el5 21andy.com 44k PHP-tidy x86_64 5.3.1-2.el5 21andy.com 31k PHP-xml x86_64 5.3.1-2.el5 21andy.com 115k PHP-xmlrpc x86_64 5.3.1-2.el5 21andy.com 48K Installing forDependenciesGMP x86_644.1.4-10.EL5 Base 201k Libxaw x86_641.0.2-8.1 Base 329k LIBXMU x86_641.0.2-5 Base 63k libxpm x86_643.5.5-3 Base 44k Libedit x86_642.11-2.20080712cvs.el5 Epel 80k Libmcrypt x86_642.5.8-4.el5.centos Extras 105k Libtidy x86_640.99.0-14.20070615.el5 Epel 140k PHP-common x86_64 5.3.1-2.el5 21andy.com 554k Sqlite2 x86_642.8.17-5.el5 21andy.com 165k t1lib x86_645.1.1-7.el5 Epel 208k Updating forDependencieslibevent x86_641.4.12-1.el5 21andy.com 129k Transaction Summary==========================================================Install26Package (s) Update1Package (s) Remove0Package (s last as long as Yum-y update, it's all up to date. Don't forget to start the boot chkconfig--level 345mysqld on Chkconfig--level 345 php-fpm on Chkconfig--level 345Nginx on to see the powerful results I tested with the virtual machine HTTP://www.21andy.com/blog/20100219/1703.htmlAdd: All configuration files are in/etc directory, including Nginx, PHP-FPM,MySQLconfiguration file, please find your own settings, the following is my Nginx configuration example first create a new/www directory, website and log are all put here don't forget to build log directory, you access_log in the configuration file/www/logs Note: Fastcgi_params to join this line#Vim/etc/nginx/fastcgi_paramsFastcgi_param Script_filename$document _root$fastcgi_script_name; #vi/etc/nginx/nginx.confuser Nobody nobody; Worker_processes8;#here, depending on your CPU and memory configuration, set 2 to 10 OK Error_log/www/logs/nginx_error.LogCrit; PID/usr/local/nginx/logs/nginx.pid; #Specifies the value for maximum file descriptors the can is opened by this process. Worker_rlimit_nofile 51200; Events { UseEpoll; Worker_connections51200; } HTTP {includeMime.types; Default_type Application/octet-stream; #charse gb2312; # default encoding, can not be setserver_names_hash_bucket_size128;      Client_header_buffer_size 16k; Large_client_header_buffers416k;       Client_max_body_size 8m;      Sendfile on;       Tcp_nopush on; Keepalive_timeout60;       Tcp_nodelay on; Fastcgi_connect_timeout300; Fastcgi_send_timeout300; Fastcgi_read_timeout300;      Fastcgi_buffer_size 64k; Fastcgi_buffers464k;      Fastcgi_busy_buffers_size 128k;       Fastcgi_temp_file_write_size 128k;      gzip on;      Gzip_min_length 1k; Gzip_buffers416k; Gzip_http_version1.0; Gzip_comp_level5; Gzip_types text/plain text/javascript application/x-javascript text/css application/XML;       Gzip_vary on; #limit_zone crawler $binary _remote_addr 10m; Server {Listen80;          server_name localhost; Root/www; Location/status {stub_status on;          Access_log off; } Location/ {              #Here are all the files and directories that do not exist, all transferred to index.php processingTry_files$uri $uri//index.php?q=$uri&$args; }                    #This place is divided into server.conf is to open the server again convenient, unified call, put into the/etc/nginx/directory        includeServer.conf; Log_format Access' $remote _addr-$remote _user [$time _local] "$request" ' $status $body _bytes_sent ' $http _referer ' ' "$http _user_agent $http _x_forwarded_for '; Access_log/www/logs/access.Logaccess; } Server {Listen80; server_name www.21andy.com 21andy.com *.21andy.com; Root/www/21andy.com; if($host!~* 21andy.com$) {              return444; } Location/{try_files$uri $uri//index.php?q=$uri&$args; }          includeserver.conf;#It's been reused here, and this section is saved.Access_log/www/logs/21andy.com_access.Logaccess; }  } #vi/etc/nginx/server.confIndex index.html index.htm Index.PHP; #limit_conn crawler 20;  Location~ /.HT {deny all; } Location~ .*. (sqlite|sq3) $ {deny all; } Location~ .*.php$ {fastcgi_pass Unix:/tmp/php-cgi.sock; #Fastcgi_pass 127.0.0.1:9000; Fastcgi_index index.PHP; includeFastcgi_params; } Location~ .*. (gif|jpg|jpeg|png|bmp|swf|ico) $ {expires 30d;  Access_log off; } Location~ .*. (JS|CSS)?$ {Expires 30d;  Access_log off; The following contents of the bank can be skipped over PHP-FPM can also be used with the following settings, but it is recommended to use the above, more stable location~ .php$ {root/www; Fastcgi_pass127.0.0.1:9000; Fastcgi_index Index.PHP; #the following line will be added to the/etc/nginx/fastcgi_params.    #Fastcgi_param script_filename $document _root$fastcgi_script_name;     includeFastcgi_params; Regardless of whether you use PHP-cgi.sock or 9000-port method, Nginx and php-FPM must also be set to the same Nginx settings above has been mentioned, remember to modify PHP at the same time-FPM.conf the corresponding place#vi/etc/php-fpm.conf127.0.0.1:9000or Unix:/tmp/php-cgi.Sock Original address: HTTP://www.21andy.com/blog/20100219/1701.html

1 minutes Perfect installation of the latest Centos+nginx+php-fpm+mysql

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.