一、nginx编译安装
依赖关系
cat /etc/redhat-release
yum update -y
yum install -y gcc gcc-c++ make libtool zlib zlib-devel openssl openssl-devel pcre pcre-devel
groupadd www #创建组
useradd -g www www #创建用户及所属用户组
./configure –user=www –group=www –with-http_ssl_module –prefix=/usr/local/nginx –with-http_v2_module –with-pcre –with-pcre-jit
chmod +x configure 添加权限
make && make install
查看配置是否正确
usr/local/nginx/sbin/nginx -t
# 启动
/usr/local/nginx/sbin/nginx
# 停止
/usr/local/nginx/sbin/nginx -s stop
# 平滑重新启动
/usr/local/nginx/sbin/nginx -s reload
设置开机启动
在 /usr/lib/systemd/system/ 目录下编写脚本
vi /usr/lib/systemd/system/nginx.service
[Unit]
Description=nginx
After=network.target
[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/usr/local/nginx/sbin/nginx -s stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl start nginx 启动
systemctl enable nginx 开机启动
systemctl restart nginx 重启
systemctl disable nginx 关闭开机启动
二、PHP多版本安装
依赖关系
yum -y install gcc gcc-c++
yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel libicu-devel freetype-devel openldap-devel openldap openldap-devel
yum -y install libmcrypt libmcrypt-devel gmp-devel readline-devel libxslt-devel sqlite-devel
创建用户和用户组
groupadd www
useradd -g www www
./configure \
–prefix=/usr/local/php71 \
–with-config-file-path=/etc \
–enable-fpm \
–enable-inline-optimization \
–disable-debug \
–disable-rpath \
–enable-shared \
–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 \
–enable-mbregex \
–enable-mbregex-backtrack \
–with-libmbfl \
–with-onig \
–enable-pdo \
–with-mysqli=mysqlnd \
–with-pdo-mysql=mysqlnd \
–with-zlib-dir \
–with-pdo-sqlite \
–with-readline \
–enable-session \
–enable-shmop \
–enable-simplexml \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–enable-wddx \
–with-libxml-dir \
–with-xsl \
–enable-zip \
–enable-mysqlnd-compression-support \
–with-pear \
–enable-opcache
make && make install
cp php.ini-production /etc/php71.ini
cp /usr/local/php71/etc/php-fpm.conf.default /usr/local/php71/etc/php71-fpm.conf
cp /usr/local/php71/etc/php-fpm.d/www.conf.default /usr/local/php71/etc/php-fpm.d/www71.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php71-fpm
cp /usr/local/php71/sbin/php-fpm /usr/local/php71/sbin/php71-fpm
chmod +x /etc/init.d/php71-fpm
设置启动文件
vi /etc/init.d/php71-fpm
service php71-fpm start #启动
service php71-fpm stop #停止
service php71-fpm restart #重启
service php71-fpm status #状态
service php71-fpm enable #开机启动
同理,其他PHP版本按照上面编译PHP71方式操作即可