时间:2021-07-01 10:21:17 帮助过:33人阅读
1、安装mysql请参照 centos 7 min 编译安装mysql5.6.20 笔记
2、编译安装php5.6+nginx1.7.5
2.1、安装php5.6.0
首先添加依赖应用
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
安装加密扩展库
cd /usr/local/src/
wget libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
cd ../
wget http://cn2.php.com/distributions/php-5.6.0.tar.gz
tar zxvf php-5.6.0.tar.gz
cd php-5.6.0
./configure --prefix=/usr/local/php-5.6.0 --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
make && make install
Build complete.
Don't forget to run 'make test'.
cp /usr/local/php-5.6.0/etc/php-fpm.conf.default php-fpm.conf
//复制一份并重命名
/usr/local/php-5.6.0/sbin/php-fpm
//启动php-fpm
修改FPM 配置文件php-fpm.conf
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
去掉分号
ln -s /usr/local/php-5.6.0/sbin/php-fpm /bin/php-fpm
cp /usr/local/src/php-5.6.0/php.ini-producsion /usr/local/php-5.6.0/lib/php.ini
至此php-fpm安装完成
===================================================================================
2.2、安装nginx1.7.5
wget http://nginx.org/download/nginx-1.7.5.tar.gz
useradd www
#添加www nginx运行账户
usermod -s /sbin/nologin -g www www
#将www加入www组并禁止www登录shell
tar zxvf nginx-1.7.5.tar.gz
cd nginx-1.7.5
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --without-http_rewrite_module --with-http_ssl_module --with-pcre
make && make install
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
#启动nginx,nginx启动成功。
/usr/local/nginx/sbin/nginx -s reload
ln -s /usr/local/nginx/sbin/nginx /usr/sbin/nginx
//接下来修改nginx配置文件,根据需要修改对应文件
vim nginx.conf
user nobody; #去掉前面
根据 include fastcgi_params;
vim fastcgi_params
添加以下,保存
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#否则nginx不能找到php文件进行解析
nginx -s reload
//nginx重启
nginx安装结束。