脚本宝典收集整理的这篇文章主要介绍了LNMP平台搭建-2简化版本,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
一。安装Nginx
方法一 :老老实实的安装
systemctl stop firewalld
iptables -F
setenforce 0
yum -y install pcre-devel zlib-devel oPEnssl-devel gcc gcc-c++ make
useradd -M -s /sbin/nologin Nginx
tar xf Nginx-1.14.2.tar.gz -C /usr/src
cd /usr/src/Nginx-1.14.2/
./configure --PRefix=/usr/local/Nginx --user=Nginx --group=Nginx --wITh-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module
ln -s /usr/local/Nginx/sbin/Nginx /usr/local/bin/
Nginx: the configuration file /usr/local/Nginx/conf/Nginx.conf Syntax is ok
Nginx: configuration file /usr/local/Nginx/conf/Nginx.conf test is successful
查看结果
[[email protected] ~]# tar xf MysqL-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local
[[email protected] ~]# cd /usr/local/
[[email protected] local]# mv MysqL-5.7.24-linux-glibc2.12-x86_64/ MysqL
[[email protected] local]# useradd -M -s /sbin/noLOGin MysqL
[[email protected] local]# chown -R MysqL:MysqL /usr/local/MysqL/
[[email protected] local]# vim /etc/my.cnf
[MysqLd]
datadir=/usr/local/MysqL/data
[MysqLd_safe]
log-error=/usr/local/MysqL/data/MysqL.log
pid-file=/usr/local/MysqL/data/MysqL.pid
[[email protected] local]# /usr/local/MysqL/bin/MysqLd --user=MysqL --basedir=/usr/local/MysqL --datadir=/usr/local/MysqL/data --initialize
[[email protected] MysqL]# echo "PATH=$PATH:/usr/local/MysqL/bin" >> /etc/profile
[[email protected] MysqL]# source /etc/profile ##这两步可以用ln -s /usr/local/MysqL/bin/* /usr/local/sbin 但是开启服务时用/etc/init.d/MysqL start
[[email protected] local]# cd MysqL/
[[email protected] MysqL]# cp support-files/MysqL.server /etc/init.d/MysqLd #复制到主配置文件就可以直接使用systemctl start MysqLd
[[email protected] MysqL]# chkconfig --add MysqLd #也可以用chmod +x /etc/init.d/MysqLd
[[email protected] MysqL]# systemctl start MysqLd
[[email protected]~]# yum -y install gd libXMl2-devel libjpeg-devel libpng-devel gcc gcc-c++ make
[[email protected] ~]# tar xf PHP-5.6.39.tar.gz -C /usr/src/
[[email protected] ~]# cd /usr/src/PHP-5.6.39/
[[email protected]]# ./configure --prefix=/usr/local/PHP5 --with-gd --with-zlib --with-MysqL=/usr/local/MysqL --with-MysqLi=/usr/local/MysqL/bin/MysqL_config --with-config-file-path=/usr/local/PHP5 --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib && make && make install
[[email protected]]#cp PHP.ini-production /usr/local/PHP5/PHP.ini
[[email protected]]# ln -s /usr/local/PHP5/bin/* /usr/local/bin/
[[email protected]]#ln -s /usr/local/PHP5/sbin/* /usr/local/sbin/
[[email protected]~]# cd
[[email protected]~]# tar xf zend-loader-PHP5.6-linux-x86_64_update1.tar.gz -C /usr/src/
[[email protected]~]# cd /usr/src/zend-loader-PHP5.6-linux-x86_64/
[[email protected] zend-loader-PHP5.6-linux-x86_64]# cp ZendGuardLoader.so /usr/local/PHP5/lib/PHP/
[[email protected] zend-loader-PHP5.6-linux-x86_64]#vim /usr/local/PHP5/PHP.ini
zend_loader.enable=1
[[email protected]~]# cd /usr/local/PHP5/etc/
[[email protected]]# cp PHP-fpm.conf.default PHP-fpm.conf
[[email protected]]#useradd -M -s /sbin/nologin PHP
sed -i ‘25c pid = run/PHP-fpm.pid‘ PHP-fpm.conf &> /dev/null
sed -i ‘149c user = PHP‘ PHP-fpm.conf &> /dev/null
sed -i ‘150c group = PHP‘ PHP-fpm.conf &> /dev/null
sed -i ‘246c pm.start_servers = 20‘ PHP-fpm.conf &> /dev/null
sed -i ‘251c pm.min_spare_servers = 5‘ PHP-fpm.conf &> /dev/null
sed -i ‘256c pm.max_spare_servers = 35‘ PHP-fpm.conf &> /dev/null
sed -i ‘241c pm.max_children = 50‘ PHP-fpm.conf &> /dev/null
/usr/local/sbin/PHP-fpm
killall PHP-fpm
/usr/local/sbin/PHP-fpm
cat << EOF > /usr/local/Nginx/htML/PHP.PHP
<?PHP
PHPinfo();
?>
EOF
vi /usr/local/Nginx/con/Nginx.conf ##修改
killall -1 ngxin
以上是脚本宝典为你收集整理的LNMP平台搭建-2简化版本全部内容,希望文章能够帮你解决LNMP平台搭建-2简化版本所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。