1 minute perfect installation of the latest CentOS + Nginx + PHP-FPM + MySQL. PHP5.3.1MySQL5.0.89Nginx0.8.33 or 0.7.65 (optional) now, we can quickly and fully automated get CentOS + Nginx + PHP-FPM + MySQL installed this comparable to what circulated on the Internet one click
PHP 5.3.1
MySQL 5.0.89
Nginx 0.8.33 or 0.7.65 (optional)
Now, we can do this quickly and automatically.CentOS + Nginx + PHP-FPM + MySQLInstalled
This is much better than what one-click installation package is available on the internet. it is strongly recommended that this installation method be suitable for all Cainiao and experts.
It's hard to compile and install all the source code used on my server.
I have installed some common extensions including PHP, PDO, eaccelerator, memcache, and tidy.
Create a repo first
- # vi /etc/yum.repos.d/centos.21andy.com.repo
Add the following content
- [21Andy.com]
- name=21Andy.com Packages for Enterprise Linux 5 - $basearch
- baseurl=http://www.21andy.com/centos/5/$basearch/
- enabled=1
- gpgcheck=0
- protect=1
Enable EPEL repo
I386
- rpm -ihv
- http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
X86_64
- rpm -ihv
- http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
Import key
- rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
All right, one-click installation
- # yum install nginx php-fpm mysql-server
If you want to use the latest stable version of nginx 0.7.65, replace yum-y install nginx with yum-y install nginx-stable.
More complete installation
- Yum-y update
- Yum-y mysql-server
- Service mysqld start
- Mysqladmin-u root password root
- Service mysqld stop
- Yum-y install nginx php-fpm
- Php-cli php-pdo php-mysql php-mcrypt php-mbstring
- Php-gd php-tidy php-xml php-xmlrpc
- Php-pear php-pecl-memcache php-eaccelerator
- # APC conflicts with eAccelerator. Select 2 and select 1.
- Yum-y install php-pecl-apc
Let's take a look at my complete installation.
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-xmlrpc php- pear php-pecl-memcache php-eaccelerator
Installation result, fully automated
- Dependencies Resolved
- ==========================================================
- Package Arch Version Repository Size
- ==========================================================
- Installing:
- mysql x86_64 5.0.89-1.el5 21Andy.com 3.5 M
- mysql-server x86_64 5.0.89-1.el5 21Andy.com 10 M
- nginx x86_64 0.8.33-3.el5 21Andy.com 422 k
- php-cli x86_64 5.3.1-2.el5 21Andy.com 2.4 M
- php-eaccelerator x86_64 2:0.9.6-1.el5 21Andy.com 118 k
- php-fpm x86_64 5.3.1-2.el5 21Andy.com 1.2 M
- php-gd x86_64 5.3.1-2.el5 21Andy.com 110 k
- php-mbstring x86_64 5.3.1-2.el5 21Andy.com 1.1 M
- php-mcrypt x86_64 5.3.1-2.el5 21Andy.com 27 k
- php-mysql x86_64 5.3.1-2.el5 21Andy.com 84 k
- php-pdo x86_64 5.3.1-2.el5 21Andy.com 91 k
- php-pear noarch 1:1.9.0-1.el5 21Andy.com 420 k
- php-pecl-memcache x86_64 2.2.5-3.el5 21Andy.com 44 k
- php-tidy x86_64 5.3.1-2.el5 21Andy.com 31 k
- php-xml x86_64 5.3.1-2.el5 21Andy.com 115 k
- php-xmlrpc x86_64 5.3.1-2.el5 21Andy.com 48 k
- Installing for dependencies:
- gmp x86_64 4.1.4-10.el5 base 201 k
- libXaw x86_64 1.0.2-8.1 base 329 k
- libXmu x86_64 1.0.2-5 base 63 k
- libXpm x86_64 3.5.5-3 base 44 k
- libedit x86_64 2.11-2.20080712cvs.el5 epel 80 k
- libmcrypt x86_64 2.5.8-4.el5.centos extras 105 k
- libtidy x86_64 0.99.0-14.20070615.el5 epel 140 k
- php-common x86_64 5.3.1-2.el5 21Andy.com 554 k
- sqlite2 x86_64 2.8.17-5.el5 21Andy.com 165 k
- t1lib x86_64 5.1.1-7.el5 epel 208 k
- Updating for dependencies:
- libevent x86_64 1.4.12-1.el5 21Andy.com 129 k
- Transaction Summary
- ==========================================================
- Install 26 Package(s)
- Update 1 Package(s)
- Remove 0 Package(s
Last as longYum-y updateIt's all the latest
Don't forget to start
- chkconfig --level 345 mysqld on
- chkconfig --level 345 php-fpm on
- chkconfig --level 345 nginx on
Let's take a look at the strong results of my virtual machine testing.
Http://www.21andy.com/blog/20100219/1703.html
Supplement: All the configuration files are under the/etc directory, including the nginx, php-fpm, and mysql configuration files. please find your own settings. The following is an example of my nginx configuration.
Create a new/WwwDirectories, websites, and logs are all stored here.
Do not forget to create a log storage directory, which is used by access_log in the configuration file./Www/logs
Note: fastcgi_params must be added to this line.
# Vim/etc/nginx/fastcgi_params
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# Vi/etc/nginx. conf
- User nobody;
-
- Worker_processes 8; # Here, based on your CPU and memory configuration, set both 2 and 10 OK
-
- Error_log/Www/logs/nginx_error.log crit;
-
- Pid/usr/local/nginx/logs/nginx. pid;
-
- # Specifies the valueForMaximum file descriptors that can be opened by this process.
- Worker_rlimit_nofile 51200;
-
- Events {
- UseEpoll;
- Worker_connections 51200;
- }
-
- Http {
- IncludeMime. types;
- Default_type application/octet-stream;
-
- # Charse gb2312; # default encoding, which can be left unspecified
-
- Server_names_hash_bucket_size 128;
- Client_header_buffer_size 16 k;
- Large_client_header_buffers 4 16 k;
- Client_max_body_size 8 m;
-
- Sendfile on;
- Tcp_nopush on;
-
- Keepalive_timeout 60;
-
- Tcp_nodelay on;
-
- Fastcgi_connect_timeout 300;
- Fastcgi_send_timeout 300;
- Fastcgi_read_timeout 300;
- Fastcgi_buffer_size 64 k;
- Fastcgi_buffers 4 64 k;
- Fastcgi_busy_buffers_size 128 k;
- Fastcgi_temp_file_write_size 128 k;
-
- Gzip on;
- Gzip_min_length 1 k;
- Gzip_buffers 4 16 k;
- Gzip_http_version 1.0;
- Gzip_comp_level 5;
- Gzip_types text/plain text/javascript application/x-javascript text/css application/xml;
- Gzip_vary on;
-
- # Limit_zone crawler$ Binary_remote_addr10 m;
- Server {
- Listen 80;
- Server_name localhost;
- Root/www;
- Location/status {
- Stub_status on;
- Access_log off;
- }
- Location /{
- # Here we will convert all non-existing files and directories to index. php for processing.
- Try_files$ Uri $ Uri// Index. php? Q =$ Uri&$ Args;
- }
-
- # Put it here separately to the server. conf for convenience during server activation and unified calling. put it in 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. log access;
- }
-
- Server {
- Listen 80;
- 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; # reuse here, which saves time
- Access_log/www/logs/21andy.com _ access. log access;
- }
- }
# Vi/etc/nginx/server. conf
- index 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;
- include fastcgi_params;
- }
-
- location ~ .*.(gif|jpg|jpeg|png|bmp|swf|ico)$ {
- expires 30d;
- access_log off;
- }
-
- location ~ .*.(js|css)?$ {
- expires 30d;
- access_log off;
- }
The following content can be skipped
You can also use the following settings for php-fpm, but we recommend that you use the settings above, which is relatively stable.
- Location ~ . Php $ {
- Root/www;
- Fastcgi_pass 127.0.0.1: 9000;
- Fastcgi_index index. php;
- # Add the following line to/etc/nginx/fastcgi_params.
- # Fastcgi_param SCRIPT_FILENAME$ Document_root$ Fastcgi_script_name;
- IncludeFastcgi_params;
- }
Both nginx and php-fpm must be set to the same either by using the php-cgi.sock or port 9000 method
Nginx settings have been mentioned above, remember to modify the php-fpm.conf at the same time the corresponding place
# Vi/etc/php-fpm.conf
127.0.0.1:9000
Or
unix:/tmp/php-cgi.sock
Original article address:Http://www.21andy.com/blog/20100219/1701.html
Http://www.bkjia.com/PHPjc/445841.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/445841.htmlTechArticlePHP 5.3.1 MySQL 5.0.89 Nginx 0.8.33 or 0.7.65 (optional) now, we can quickly and fully automated get CentOS + Nginx + PHP-FPM + MySQL installed this comparable to what one-click spread on the internet...