LNMP(3)php服务搭建

4 篇文章 0 订阅
1 篇文章 0 订阅

安装php
安装程序包
tar zxvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
./configure
Make
Make install
Cd …
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
Make
Make install
Cd …
tar xjvf libvpx-v1.3.0.tar.bz2
cd libvpx-v1.3.0
./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9
Make
Make install
Cd …
tar zxvf tiff-4.0.3.tar.gz
cd tiff-4.0.3
./configure --prefix=/usr/local/tiff --enable-shared
make
make install
cd …
tar zxvf libpng-1.6.12.tar.gz
./configure --prefix=/usr/local/libpng --enable-shared
make
make install
cd …
tar zxvf libpng-1.6.12.tar.gz
cd libpng-1.6.12
./configure --prefix=/usr/local/libpng --enable-shared
make
make install
cd …
tar zxvf freetype-2.5.3.tar.gz
cd freetype-2.5.3
./configure --prefix=/usr/local/freetype --enable-shared
make
make install
cd …
cd …
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a
./configure --prefix=/usr/local/jpeg --enable-shared
make
make install
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
cd …
tar zxvf t1lib-5.1.2.tar.gz
cd t1lib-5.1.2
./configure --prefix=/usr/local/t1lib --enable-shared
make
make install
安装后把/usr/lib64目录中的函数文件链接到/usr/lib目录中,以便系统能够顺利调取到函数文件
ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so
cp -frp /usr/lib64/libXpm.so* /usr/lib/
cd …
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
rm -rf /etc/php.ini
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,148,149
25 pid = run/php-fpm.pid
148 user = www
149 group = www
配置妥当后便可把用于管理php服务的脚本文件复制到/etc/rc.d/init.d中了。为了能够执行脚本,请记得为脚本赋予755权限。最后把php-fpm服务程序加入到开机启动项中
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
由于php服务程序的配置参数直接会影响到Web服务服务的运行环境,因此,如果默认开启了一些不必要且高危的功能(如允许用户在网页中执行Linux命令),则会降低网站被入侵的难度,入侵人员甚至可以拿到整台Web服务器的管理权限。因此我们需要编辑php.ini配置文件,在305行的disable_functions参数后面追加上要禁止的功能。下面的禁用功能名单是刘遄老师依据网站运行的经验而定制的,不见得适合每个生产环境,建议大家在此基础上根据自身工作需求酌情删减:
vim /usr/local/php/etc/php.ini
300
301 ; This directive allows you to disable certain functions for security reasons.
302 ; It receives a comma-delimited list of function names. This directive is
303 ; NOT affected by whether Safe Mode is turned On or Off.
304 ; http://php.net/disable-functions
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
修改配置文件:
vim /usr/local/nginx/conf/nginx.conf
2 user www www;
69 fastcgi_param SCRIPT_FILENAME d o c u m e n t r o o t document_root documentrootfastcgi_script_name;
重启服务
systemctl restart nginx
systemctl restart php-fpm
解压文件:
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
安装:

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值