部署LNMP网络平台
作者:互联网
一、安装nginx
挂载系统盘
创建运行账户和组,
解tar包
编译安装
开启服务
测试nginx网页
二、配置虚拟Web主机
1.配置DNS服务
[root@centos04 ~]# yum -y install bind bind-chroot bind-utils
[root@centos04 ~]# vim /etc/named.conf
[root@centos04 ~]# vim /var/named/bdqn.com.zone
[root@centos04 ~]# vim /var/named/accp.com.zone
[root@centos05 ~]# systemctl restart named
[root@centos04 ~]# mkdir -p /var/www/bdqn
[root@centos04 ~]# mkdir -p /var/www/accp
[root@centos04 ~]# echo “www.bdqn.com” > /var/www/bdqn/index.html
[root@centos04 ~]# echo “www.accp.com” > /var/www/accp/index.html
[root@centos05 ~]# vim /usr/local/nginx/conf/nginx.conf
检查配置文件
[root@centos05 ~]# killall nginx
[root@centos05 ~]# nginx
安装mysql
[root@centos04 ~]# yum -y install ncurses-devel.x86_64
[root@centos04 ~]# tar zxvf /mnt/cmake-2.8.6.tar.gz -C /usr/src/
[root@centos04 cmake-2.8.6]# ./configure gmake && gmake install
[root@centos04 ~]# tar zxvf /mnt/mysql-5.5.22.tar.gz -C /usr/src/
[root@centos04 mysql-5.5.22]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_
CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc
[root@centos04 mysql-5.5.22]# make && make install
[root@centos04 mysql-5.5.22]# cp support-files/my-medium.cnf /etc/my.cnf
[root@centos04 mysql-5.5.22]# cp support-files/mysql.server /etc/init.d/mysqld
[root@centos04 mysql-5.5.22]# chmod +x /etc/init.d/mysqld
[root@centos04 mysql-5.5.22]# chkconfig --add mysqld
[root@centos04 mysql-5.5.22]# chkconfig --level 35 mysqld on
[root@centos04 mysql-5.5.22]# vim /etc/profile
PATH=$PATH:/usr/local/mysql/bin/
[root@centos04 mysql-5.5.22]# source /etc/profile
[root@centos04 mysql-5.5.22]# groupadd mysql
[root@centos04 mysql-5.5.22]# useradd -M -s /sbin/nologin -g mysql mysql
[root@centos04 mysql-5.5.22]# chown -R mysql:mysql /usr/local/mysql/
[root@centos04 mysql-5.5.22]# /usr/local/mysql/scripts/mysql_install_db --basedir=/usr
/local/mysql --datadir=/usr/local/mysql/data --user=mysql
四、安装PHP
[root@centos04 ~]# yum -y install gd libxml2-devel.x86_64 libjpeg-turbo-devel.x86_64 libpng-devel.x86_64
[root@centos04 ~]# tar zxvf /mnt/php-5.3.28.tar.gz -C /usr/src/
[root@centos04 ~]# cd /usr/src/php-5.3.28/
[root@centos04 php-5.3.28]# ./configure --prefix=/usr/local/php --with-gd --with-zlib
–with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm --with-jpeg-dir=/usr/lib
[root@centos04 php-5.3.28]# make && make install
[root@centos04 php-5.3.28]# cp php.ini-production /usr/local/php/php.ini
[root@centos04 php-5.3.28]# ln -s /usr/local/php/bin/* /usr/local/bin
[root@centos04 php-5.3.28]# ln -s /usr/local/php/sbin/* /usr/local/sbin/
[root@centos04 ~]# tar zxvf /mnt/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/
[root@centos04 ZendGuardLoader-php-5.3-linux-glibc23-x86_64]# cd php-5.3.x/
[root@centos04 php-5.3.x]# cp ZendGuardLoader.so /usr/local/php/lib/php
五、配置nginx支持PHP环境
[root@centos04 ~]# cd /usr/local/php/etc/
[root@centos04 etc]# cp php-fpm.conf.default php-fpm.conf
[root@centos04 etc]# useradd -M -s /sbin/nologin php
[root@centos04 etc]# vim php-fpm.conf
[root@centos04 ~]# vim /usr/local/nginx/conf/nginx.conf
六、部署论坛
[root@centos01 ~]# unzip Discuz_X3.2_SC_UTF8.zip
[root@centos01 ~]# mv upload/* /var/www/bdqn/bbs
[root@centos01 ~]# chown -R nginx:nginx /var/www/bdqn/bbs/
[root@centos01 ~]# chmod -R 755 /var/www/bdqn
[root@centos01 ~]# mysql -uroot -ppwd@123
mysql> create database bbs;
mysql> grant all on bbs.* to ‘bbs’@‘localhost’ identified by ‘pwd@123’;
标签:部署,local,centos04,LNMP,网络平台,usr,mysql,php,root 来源: https://blog.csdn.net/NB_____/article/details/116798616