1、lnmp架构
2、mysql的安装:
mysql5.6自动安装脚本:
yum install perl-Data-Dumper.x86_64 libaio.x86_64 libaio-devel.x86_64 -y
useradd -M mysql -s /sbin/nologinwget -c http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gztar -xvf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gzmv ./mysql-5.6.36-linux-glibc2.5-x86_64 /usr/local/mysql56chown -R mysql.mysql /usr/local/mysql56/cd /usr/local/mysql56./scripts/mysql_install_db --user="mysql" --basedir="/usr/local/mysql56" --datadir="/usr/local/mysql56/data" --defaults-file="/etc/mysql.cnf" --socket="/tmp/mysqld.sock"cp support-files/my-default.cnf /etc/mysql.cnfecho "basedir=/usr/local/mysql56" >>/etc/mysql.cnfecho "datadir=/usr/local/mysql56/data/" >>/etc/mysql.cnfecho "port=3306" >>/etc/mysql.cnfecho "user=mysql" >>/etc/mysql.cnfcp support-files/mysql.server /etc/init.d/mysqldsed -i "s#^basedir=.*#basedir=/usr/local/mysql56#g" /etc/init.d/mysqldsed -i "s#^datadir=.*#datadir=/usr/local/mysql56/data/#g" /etc/init.d/mysqldchown -R root.root /usr/local/mysql56chown -R mysql. /usr/local/mysql56/data/etc/init.d/mysqld startnetstat -tulnp | grep 3306添加到服务启动项里面:
3、php-fpm的安装:
下载:
wget -c http://cn2.php.net/distributions/php-5.6.36.tar.gz (php5)
wget -c http://cn2.php.net/distributions/php-7.2.5.tar.gz (php7)
解压:
tar -xvf php-5.6.36.tar.gz
tar -xvf php-7.2.5.tar.gz
进入到解压后的目录里面去:
cd php-5.6.36
运行:make clean 命令添加用户:useradd -M php-fpm -s /sbin/nologin生成配制文件:./configure --prefix=/usr/local/php5-fpm --with-config-file-path=/usr/local/php5-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql56 --with-pdo-mysql=/usr/local/mysql56 --with-mysqli=/usr/local/mysql56/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-ftp --with-curl --with-pear --enable-exif若遇到错误就安装需要依赖的模块如:yum install libcurl libcurl-devel -y编译安装:make && make install对配制文件进行配制:cp /home/nfyx/source/php-5.6.36/php.ini-production /usr/local/php5-fpm/etc/php.ini配制: /usr/local/php5-fpm/etc/php-fpm.conf 加入以下代码:[global]
pid = /usr/local/php5-fpm/var/run/php-fpm.piderror_log = /usr/local/php5-fpm/var/log/php-fpm.log[www]listen = /tmp/php-fcgi.socklisten.mode = 666user = php-fpmgroup = php-fpmpm = dynamicpm.max_children = 50pm.start_servers = 20pm.min_spare_servers = 5pm.max_spare_servers = 35pm.max_requests = 500rlimit_files = 1024 配制文件语法检查:/usr/local/php5-fpm/sbin/php-fpm -t对启动文件进行设置:
cp /home/nfyx/source/php-5.6.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm更改权限:chmod 755 /etc/init.d/php-fpm启动:/etc/init.d/php-fpm start添加到服务启动项:chkconfig --add /etc/init.d/php-fpm
查看服务:ps aux |grep php-fpm图例:
编译前配制:
/usr/local/php5-fpm/etc/ php-fpm.conf r的配制:
语法检查、启动、查看
4、nginx:官网:www.nginx.org
下载:wget -c http://nginx.org/download/nginx-1.14.0.tar.gz解压:tar -zxvf nginx-1.14.0.tar.gz进入:cd nginx-1.14.6生成配制文件:./configure --prefix=/usr/local/nginx编译安装:make && make install