1.編譯nginx主要參數:

需要事先編譯安裝 pcre

再安裝關聯套件:yum install –y gcc gcc-c++

./configure –prefix=/usr/local/nginx

 

編譯安裝:

make && make install

 

2.編譯:mysql5.6主要參數:

安裝相關關聯套件:yum  install  –y cmake ncurese-devel ncureses libaio libaio-devel bison

預編譯:

cmake . -dcmake_install_prefix=/usr/local/mysql -dmysql_user=mysql -dmysql_tcp_port=3306 -dmysql_unix_addr=/tmp/mysql.sock -dsysconfdir=/etc -ddefault_charset=utf8 -ddefault_collation=utf8_general_ci -denable_local_infile=1 -dwith_myisam_storage_engine=1 -dwith_innobase_storage_engine=1  -dwith_debug=0 -dwith_big_tables=1 .

 

編譯安裝:

make && make install

啟動nginx :

/usr/local/nginx/sbin/nginx

 

3.編譯:php   主要參數:

注意  務必要先安裝依賴包

yum install -y openldap openldap-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel

cp -frp /usr/lib64/libldap* /usr/lib/

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –enable-fpm –enable-mbstring  –enable-bcmath –enable-mysqlnd –enable-session –enable-xml –with-gettext   –with-ldap –enable-sockets  –with-jpeg-dir –with-freetype-dir –with-png-dir

編譯:7.1主要參數:

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –enable-mbstring –enable-bcmath –enable-xml –enable-fpm –enable-session –enable-mysqlnd  –enable-sockets –enable-xml –with-gd –with-png-dir –with-jpeg-dir –with-ldap  –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-gettext –with-freetype-dir

 

必須編輯Makefile   找到:EXTRA_LIBS = 在其後面添加 -llber

 

 

編譯安裝:

 

make && make install

 

複製設定檔

cp /usr/local/php/etc/php/ php-fpm.conf.default  /usr/local/php/etc/php/ php-fpm.conf

啟動php:

/usr/local/php/sbin/php-fpm

 

4.nginx與php

添加下面代碼:

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;

}

  1. nginx與phpredis

複製 php源碼包下的php.ini-development 到/usr/local/php/etc/下 取名叫php.ini

下載:phpize

 

生成phpredis 的configure檔:

預設是沒有 configure這個檔的 需要執行如下命令 生成  configure.

 

/usr/local/php/bin/phpize

 

預編譯phpredis

./configure –-with-php-config=/usr/local/php/bin/php-config –enable-redis

 

 

 

/usr/local/php/etc/php.ini 添加redis信息:

extension=”redis.so”

 

 

 

6.安裝redis

 

下載解壓  redis包

 

make 有時需要添加 MALLOC=libc

 

 

Make PREFIX=/usr/local/redis/  install

 

make test

 

 

 

將源碼包的redis.conf 複製到  /usr/local/redis/

 

編輯/usr/local/redis/redis.conf

 

將daemonize=no 改為daemonize=yes

 

 

啟動redis:

 

/usr/local/redis/bin/redis-server  redis.conf

 

 

用戶端連線 redis:

 

/usr/local/redis/bin/redis-cli

 

輸入ping

如果顯示PONG 則代表連線成功

 

 

 

打赏