LNP 安装部署
admin
2023-03-24 10:01:36
0

一、安装nginx

1.安装依赖包:

yum install openssl openssl-devel pcre GeoIP perl-devel perl perl-ExtUtils-Embed GeoIP-devel libatomic libatomic_ops-devel

2.安装zlib

tar -xf zlib-1.2.11.tar.gz 
cd zlib-1.2.11
./configure 
make
make install

3.添加用户

adduser nginx -s /sbin/nologin

4.编译安装nginx

tar -xf nginx-1.10.3.tar.gz
cd nginx-1.10.3
./configure  \
--prefix=/usr/local/nginx \
--pid-path=/usr/local/nginx \
--user=nginx \
--group=nginx \
--with-threads \
--with-file-aio \
--with-http_ssl_module \
--with-http_v2_module  \
--with-http_addition_module \
--with-http_sub_module \
--with-http_dav_module \
--with-http_flv_module \
--with-http_mp4_module \
--with-http_perl_module \
--with-http_geoip_module \
--with-http_gunzip_module \
--with-http_auth_request_module \
--with-mail \
--with-http_gzip_static_module \
--with-http_auth_request_module  \
--with-http_random_index_module \
--with-http_secure_link_module \
--with-http_degradation_module \
--with-http_slice_module \
--with-http_stub_status_module \
--with-http_perl_module \
--with-zlib=/tmp/soft/zlib-1.2.11 \
--with-stream \
--with-stream_ssl_module \
--with-pcre \
--with-libatomic
make
make install

5.添加脚本

cd /etc/init.d/
vim nginx 
#!/bin/bash
# nginx Startup script for the Nginx HTTP Server
# it is v.0.0.2 version.
# chkconfig: - 85 15
# description: Nginx is a high-performance web and proxy server.
#       It has a lot of features, but it's not for everyone.
# processname: nginx
# pidfile: /usr/local/nginx/logs/nginx.pid
# config: /usr/local/nginx/conf/nginx.conf
nginxd=/usr/local/nginx/sbin/nginx
nginx_config=/usr/local/nginx/conf/nginx.conf
nginx_pid=/usr/local/nginx/logs/nginx.pid
RETVAL=0
prog="nginx"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0
[ -x $nginxd ] || exit 0
# Start nginx daemons functions.
start() {
if [ -e $nginx_pid ];then
  echo "nginx already running...."
  exit 1
fi
  echo -n $"Starting $prog: "
  daemon $nginxd -c ${nginx_config}
  RETVAL=$?
  echo
  [ $RETVAL = 0 ] && touch /var/lock/subsys/nginx
  return $RETVAL
}
# Stop nginx daemons functions.
stop() {
    echo -n $"Stopping $prog: "
    killproc $nginxd
    RETVAL=$?
    echo
    [ $RETVAL = 0 ] && rm -f /var/lock/subsys/nginx /usr/local/nginx/logs/nginx.pid
}
# reload nginx service functions.
reload() {
  echo -n $"Reloading $prog: "
  #kill -HUP `cat ${nginx_pid}`
  killproc $nginxd -HUP
  RETVAL=$?
  echo
}
# See how we were called.
case "$1" in
start)
    start
    ;;
stop)
    stop
    ;;
reload)
    reload
    ;;
restart)
    stop
    start
    ;;
status)
    status $prog
    RETVAL=$?
    ;;
*)
    echo $"Usage: $prog {start|stop|restart|reload|status|help}"
    exit 1
esac
exit $RETVAL

重新装载:

systemctl daemon-reload

启动nginx

systemctl start nginx.service

二、安装PHP

1.安装依赖包

yum -y install make apr* autoconf automake curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd  kernel keyutils  patch  perl kernel-headers mpfr cpp glibc libgomp libstdc++-devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch

2.安装libmcrypt

tar -xf libmcrypt-2.5.8.tar.gz 
cd libmcrypt-2.5.8
./configure 
make
make install

3.安装libxml2

tar -xf libxml2-2.8.0.tar.gz 
cd libxml2-2.8.0
./configure --prefix=/usr/local/libxml2
make
make install

4.安装libpng

tar -xf libpng-1.5.28.tar.xz 
cd libpng-1.5.28
./configure --prefix=/usr/local/libpng
make
make install

5.安装jpeg9

tar -xf jpegsrc.v9b.tar.gz 
cd jpeg-9b/
./configure --prefix=/usr/local/jpeg9 --enable-shared
make
make install

6.安装gettext

tar -xf gettext-0.19.8.tar.xz 
cd gettext-0.19.8
./configure 
make
make install

7.安装libpng

tar -xf libgd-2.2.4.tar.xz 
cd libgd-2.2.4
./configure --prefix=/usr/local/libgd --with-zlib --with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg9
make
make install

8.安装freetype

 wget http://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz
tar -xf freetype-2.7.1.tar.gz 
cd freetype-2.7.1
./configure --prefix=/usr/local/freetype
make
make install

9.安装libiconv

tar -xf libiconv-1.15.tar.gz 
cd libiconv-1.15
./configure --prefix=/usr/local/libiconv
make
make install

10.安装php-5.6

tar -xf php-5.6.30.tar.xz 
cd php-5.6.30
./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql --with-mysqli --with-pdo-mysql --enable-pdo --with-pdo-sqlite --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf  --enable-opcache --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-libxml-dir=/usr/local/libxml2 --with-gd --with-jpeg-dir=/usr/local/jpeg9 --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype
make
make install

11.添加用户

adduser -s /sbin/nologin php


12.配置php

cp php.ini-production /usr/local/php5/etc/php.ini
rm -f /etc/php.ini 
ln -s /usr/local/php5/etc/php.ini /etc/php.ini
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm

13.安装opcache

cd /tmp/soft/php-5.6.30
cd ext/opcache/
# /usr/local/php5/bin/phpize 
# ./configure --with-php-config=/usr/local/php5/bin/php-config
# make
# make install
Installing shared extensions:     /usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/
Installing PHP CLI binary:        /usr/local/php5/bin/
Installing PHP CLI man page:      /usr/local/php5/php/man/man1/
Installing PHP FPM binary:        /usr/local/php5/sbin/
Installing PHP FPM config:        /usr/local/php5/etc/
Installing PHP FPM man page:      /usr/local/php5/php/man/man8/
Installing PHP FPM status page:   /usr/local/php5/php/php/fpm/
Installing PHP CGI binary:        /usr/local/php5/bin/
Installing PHP CGI man page:      /usr/local/php5/php/man/man1/
Installing build environment:     /usr/local/php5/lib/php/build/
Installing header files:           /usr/local/php5/include/php/
Installing helper programs:       /usr/local/php5/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/php5/php/man/man1/
  page: phpize.1
  page: php-config.1
/tmp/soft/php-5.6.30/build/shtool install -c ext/phar/phar.phar /usr/local/php5/bin
ln -s -f phar.phar /usr/local/php5/bin/phar
Installing PDO headers:           /usr/local/php5/include/php/ext/pdo/

14.添加opcache

vim /etc/php.ini
.....
[opcache]
zend_extension=/usr/local/php5/lib/php/extensions/no-debug-non-zts-20131226/opcache.so
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=4
opcache.max_accelerated_files=8000
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=0
opcache.revalidate_path=0
opcache.save_comments=0
opcache.load_comments=0
opcache.force_restart_timeout=3600


相关内容

热门资讯

特朗普下令不打了,美国的“余粮... 可以说戛然而止,快得让很多人都无法适应。前两周,每一天美国都要打击伊朗一通。就在7月24日白宫会议前...
穆杰塔巴最新表态:支持黎真主党 △伊朗最高领袖穆杰塔巴·哈梅内伊(资料图)当地时间7月26日晚,伊朗最高领袖穆杰塔巴·哈梅内伊对黎巴...
美军瘫痪一艘驶向伊朗的油轮,特... 美国总统特朗普虽下令暂停打击伊朗,但美军仍在执行对霍尔木兹海峡的封锁任务。针对美军瘫痪一艘驶向伊朗油...
“小牌大耍”的底气到底是哪里来... 澎湃首席评论员 李平这两天,“艺人李权哲乘高铁占座事件”在网上引发热议,该艺人参加的活动主办方曾发布...
越南籍船舶南海遇险沉没,中方已... 据凤凰卫视报道,一艘越南船舶7月24日夜间在越南庆和以东220海里附近遇险沉没,船上共62名越南籍人...
李权哲占座、蒙面、装死:娱乐圈... 你买了一张高铁一等座的票,找到自己的位置,18A。有人坐着。你拿出手机看了眼购票记录——没错,18A...
杭州景区咖啡店闯入1条幼蛇,仅... 夏天气温高、湿度大,蛇类活动进入高峰期,千万别被“小蛇无害”的刻板印象骗了!有些幼蛇看着迷你可爱,实...
AI开源公开信签署企业增至50... IT之家 7 月 26 日消息,英伟达、微软、IBM、Meta 等 25 家美国科技企业本周(7 月...
南阳快手短视频代运营企业的服务... 在短视频平台快速发展的背景下,企业通过快手等渠道进行内容运营已成为常见的市场动作。对于希望借助短视频...
普通人该如何跟上科技发展的步伐 这个被称作科技的词汇, 听起来既有宏大之感, 又颇为遥远, 好似仅仅归属于在实验室里专心致志钻研的科...