Centos is the easiest way to install nginx + mysql + php + fastcgi + memcache
I. Update yumYum-y update
Ii. upgrade various libraries using yum1. LANG = C2.yum-y install gcc-c ++ autoconf libjpeg-devel libpng-devel freetype-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel openssl-devel openldap-devel nss_ldap openldap-clients openldap-servers
3. Install nginx
Since centos does not have the default nginx package, you need to enable REHL's attachment package 1.rpm-Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm2.yum-y install nginx
Set startup
Chkconfig nginx onnginx: http://www.uusnn.com.cn /? Attachment_id = 81 (delete .rar)
Configure nginx
The nginx. conf configuration file is as follows:
User nginx;
Worker_processes 1;
Error_log/var/log/nginx/error. log;
Pid/var/run/nginx. pid;
Events {
Worker_connections 1024;
}
Http {
Include/etc/nginx/mime. types;
Default_type application/octet-stream; access_log/var/log/nginx/access. log; sendfile on;
# Tcp_nopush on; # keepalive_timeout 0;
Keepalive_timeout 65; gzip on; # Load config files from the/etc/nginx/conf. d directory
Include/etc/nginx/conf. d/*. conf; server {
Listen 80;
Server_name _; root/usr/share/nginx/html;
Include common_www;
}}
The common_www file is as follows: index index.html index.htm; error_page 404/404 .html;
Location =/404.html {
Root/usr/share/nginx/html;
} Error_page 500 502 503 504/50 x.html;
Location =/50x.html {
Root/usr/share/nginx/html;
} Location ~ \. Php $ {
Root html;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Include fastcgi_params;
} Location ~ /\. Ht {
Deny all;
}
4. install php and memcache
Yum-y install php-cli php-pdo php-mcrypt php-mbstring php-json php-fastcgi php-cgi 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
5. Install spawn-fcgi to run php-cgiYum install spawn-fcgi
6. Download the startup script of spawn-fcgi
Wget http://bash.cyberciti.biz/dl/419.sh.zip
Unzip 419.sh.zip
Mv 419.sh/etc/init. d/php_cgi
Chmod + x/etc/init. d/php_cgi start php_cgi/etc/init. d/php_cgi start view process netstat-tulpn | grep: 9000 if the following shows all normal tcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 4352/php-cgi: 419.sh.zip http://www.uusnn.com.cn /? Attachment_id = 80
VII.
,
Install mysql
Yum-y install mysql-server Plugin install MySQL
Yum-y install php-mysql plugin install php-mysqlvi/etc/my. cnf
Add in [mysqld]
Default-character-set = utf Add the following chapter at the end [mysql]
Default-character-set = utf8 and then start mysqlchkconfig mysqld on startup. set MySQL service to automatically start chkconfig-list mysqld restart as the system starts.
Mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off done if 2-5 is on OK
/Etc/rc. d/init. d/mysqld start secret start MySQL service set initial password mysqladmin-u root password 123456