1、 安装yasm编译器
2、 安装libmcrypt加密算法扩展库
cd …
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
3、 安装libvpx视频编码器
4、 安装Tiff标签图像文件格式
5、 安装libpng图片函数库
6、 安装freetype字体引擎
cd …
tar zxvf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure --prefix=/usr/local/freetype --enable-shared
Make
Make install
7、 安装jpeg图片(jpeg格式)函数库
cd …
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=/usr/local/jpeg --enable-shared
make
make install
8、 安装libgd图像处理程序
cd …
tar zxvf libgd-2.1.0.tar.gz
cd libgd-2.1.0
./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx
make
make install
9、 安装t1lib图片生成函数库
cd /usr/local/src
tar zxvf t1lib-5.1.2.tar.gz
cd t1lib-5.1.2
./configure --prefix=/usr/local/t1lib --enable-shared
make
make install
10、 将函数库文件放至合适的位置:
Cd /usr/local/src
ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so
cp -frp /usr/lib64/libXpm.so* /usr/lib/
11、 安装php服务程序
Tar –zvxf php-5.5.14.tar.gz
cd php-5.5.14
export LD_LIBRARY_PATH=/usr/local/libgd/lib
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype
Make
Make install
12、 复制PHP的配置文件及删除默认配置文件
cp php.ini-production /usr/local/php/etc/php.ini
rm -rf /etc/php.ini
13、 创建php配置文件软连接到/etc目录下并编辑PHP配置文件和.conf配置文件
ln -s /usr/local/php/etc/php.ini /etc/php.ini
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
//将第25行参数前面的分号去掉。
pid = run/php-fpm.pid
//修改第148和149行,将user与group修改为www。
user = www
group = www
14、 把用于管理php服务的脚本文件复制到/etc/rc.d/init.d并赋予权限
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod 755 /etc/rc.d/init.d/php-fpm
chkconfig php-fpm on
15、 编辑php.init文件
vim /usr/local/php/etc/php.ini
在305行添加:
disable_functions= passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restor e,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,g etservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,po six_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_ getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_ setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname
16、 编辑Nginx服务程序的主配置文件
vim /usr/local/nginx/conf/nginx.conf
第2行: user www www;
第45行:index index.html index.htm index.php;
第65行: location ~ .php$ {
第66行: root html;
第67行: fastcgi_pass 127.0.0.1:9000;
第68行 fastcgi_index index.php;
第69行 fastcgi_param SCRIPT_FILENAME
d
o
c
u
m
e
n
t
r
o
o
t
document_root
documentrootfastcgi_script_name;
第70行 include fastcgi_params;
第71行 }
17、 重启服务
systemctl restart nginx
systemctl restart php-fpm
18、 搭建Discuz论坛
cd /usr/local/src/
unzip Discuz_X3.2_SC_GBK.zip
rm -rf /usr/local/nginx/html/{index.html,50x.html}*
mv upload/* /usr/local/nginx/html/
chown -Rf www:www /usr/local/nginx/html
chmod -Rf 755 /usr/local/nginx/html
19、 测试