CentOS 6.4 install nginx+php5.4+mysql
http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz
./configure --prefix=/data/system/pcre8
make&&make install
download nginx
/usr/sbin/groupadd nginx
/usr/sbin/useradd -g nginx nginx
/usr/sbin/usermod -a -G webuser nginx (Add wordpress user 'webuser' into nginx group)
./configure --user=nginx --group=nginx --prefix=/data/system/nginx --with-pcre=/data/system/source/nginx/pcre-8.34 --with-zlib=/data/system/source/nginx/zlib-1.2.8 --with-http_ssl_module
yum install libxml2 libxml2-devel curl-devel free-type-devel
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/data/system/libiconv
Compile PHP-5.4
./configure --prefix=/data/system/php5.4 --with-zlib --with-libxml --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf=shared --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-config-file-path=/data/system/php5.4/etc --with-iconv=/data/system/libiconv --disable-ipv6 --enable-static --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap --with-gettext --enable-sysvsem --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --with-curl --with-curlwrappers --enable-mbregex --enable-bcmath --enable-shmop --enable-suhosin --with-libevent=shared --with-gd --with-mcrypt --enable-zip --enable-soap --enable-mime-magic --enable-cgi --enable-xml --enable-ftp --enable-json --enable-ctype --enable-gd-native-ttf
cp php.ini-production /data/system/php5.4/etc/php.ini
cp /data/system/php5.4/etc/php-fpm.conf.default /data/system/php5.4/etc/php-fpm.conf
killall php-fpm
cp php-5.4.26/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig on php-fpm
service php-fpm restart
(= /data/system/php5.4/sbin/php-fpm -c /data/system/php5.4/etc/php.ini -y /data/system/php5.4/etc/php-fpm.conf)
附nginx.conf的主要配置部分:
user nginx nginx;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml application/json image/png image/jpeg image/gif;
gzip_vary on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
alias /data/www/web/;
index index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/web/$fastcgi_script_name;
include fastcgi.conf;
}
}
location /myadminphp {
alias /data/www/phpmyadmin/;
index index.php index.html;
access_log off;
error_log off;
#charset gb2312;
}
location ~ ^/myadminphp/.+\.php$ {
rewrite /myadminphp/(.+\.php) /$1 break;
#above line is important !!!
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/phpmyadmin$fastcgi_script_name;
}
#error_page 404 /404.html;
http://downloads.sourceforge.net/project/pcre/pcre/8.34/pcre-8.34.tar.gz
./configure --prefix=/data/system/pcre8
make&&make install
download nginx
/usr/sbin/groupadd nginx
/usr/sbin/useradd -g nginx nginx
/usr/sbin/usermod -a -G webuser nginx (Add wordpress user 'webuser' into nginx group)
./configure --user=nginx --group=nginx --prefix=/data/system/nginx --with-pcre=/data/system/source/nginx/pcre-8.34 --with-zlib=/data/system/source/nginx/zlib-1.2.8 --with-http_ssl_module
yum install libxml2 libxml2-devel curl-devel free-type-devel
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
./configure --prefix=/data/system/libiconv
Compile PHP-5.4
./configure --prefix=/data/system/php5.4 --with-zlib --with-libxml --enable-gd-native-ttf --enable-gd-jis-conv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-ttf=shared --enable-mbstring --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/lib/mysql/mysql.sock --with-config-file-path=/data/system/php5.4/etc --with-iconv=/data/system/libiconv --disable-ipv6 --enable-static --enable-zend-multibyte --enable-inline-optimization --enable-zend-multibyte --enable-sockets --enable-soap --with-gettext --enable-sysvsem --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --with-curl --with-curlwrappers --enable-mbregex --enable-bcmath --enable-shmop --enable-suhosin --with-libevent=shared --with-gd --with-mcrypt --enable-zip --enable-soap --enable-mime-magic --enable-cgi --enable-xml --enable-ftp --enable-json --enable-ctype --enable-gd-native-ttf
cp php.ini-production /data/system/php5.4/etc/php.ini
cp /data/system/php5.4/etc/php-fpm.conf.default /data/system/php5.4/etc/php-fpm.conf
killall php-fpm
cp php-5.4.26/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
chkconfig on php-fpm
service php-fpm restart
(= /data/system/php5.4/sbin/php-fpm -c /data/system/php5.4/etc/php.ini -y /data/system/php5.4/etc/php-fpm.conf)
附nginx.conf的主要配置部分:
user nginx nginx;
worker_processes 8;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml application/json image/png image/jpeg image/gif;
gzip_vary on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
alias /data/www/web/;
index index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/web/$fastcgi_script_name;
include fastcgi.conf;
}
}
location /myadminphp {
alias /data/www/phpmyadmin/;
index index.php index.html;
access_log off;
error_log off;
#charset gb2312;
}
location ~ ^/myadminphp/.+\.php$ {
rewrite /myadminphp/(.+\.php) /$1 break;
#above line is important !!!
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/www/phpmyadmin$fastcgi_script_name;
}
#error_page 404 /404.html;