nginx1.6 + php5.4+phpmyadmin 编译安装配置

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;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值