1、基于lnmp环境部署两台门户网站,wordpress,discuz lnmp->Linux nginx mariadb php CentOS 7
1.安装mysql yum install mariadb -y
2.安装nginx #下载源码: [root@node3 local]# wget http://nginx.org/download/nginx-1.18.0.tar.gz
#解压 [root@node3 local]# tar xf nginx-1.18.0.tar.gz [root@node3 local]# cd nginx-1.18.0/ #预编译: [root@node3 nginx-1.18.0]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module
#编译/安装 [root@node3 nginx-1.18.0]# make && make install #修改/usr/local/nginx/conf/nginx.conf nginx进程用户为nginx user nginx; 在server上面添加 include vhost/*.conf; #创建配置目录 [root@node3 html]# mkdir -p /usr/local/nginx/conf/vhost
#启动nginx进程 [root@node3 html]# /usr/local/nginx/sbin/nginx #查看nginx进程启动情况
#查看nginx的默认端口
3.安装php #安装依赖: [root@node3 ~]# yum -y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel #解压包:
[root@node3 ~]# tar xf php-5.6.8.tar.bz2 [root@node3 ~]# cd php-5.6.8
#预编译 [root@node3 php-5.6.8]# ./configure --prefix=/usr/local/php --enable-fpm --enable-debug --with-gd --with-jpeg-dir --with-freetype-dir --enable-mbstring --with-curl --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-config-file-path=/usr/local/php/etc --with-zlib-dir
#编译/安装 [root@node3 php-5.6.8]# make && make install
[root@node3 php-5.6.8]# cp php.ini-development /usr/local/php/etc/php.ini [root@node3 php-5.6.8]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
[root@node3 php-5.6.8]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm [root@node3 php-5.6.8]# chmod +x /etc/init.d/php-fpm
#启动php-fpm: [root@node3 php-5.6.8]# /etc/init.d/php-fpm start Starting php-fpm done
4.上传wordpress网站
解压包到nginx发布目录:
[root@node3 src]# tar xf wordpress-4.9.4-zh_CN.tar.gz -C /usr/local/nginx/html/
[root@node3 html]# chown nobody. -R /usr/local/nginx/html/wordpress/
5.创建wordpress虚拟主机: #配置虚拟主机配置文件 [root@node3 vhost]# vim /usr/local/nginx/conf/vhost/blog.wordpress.com.conf
6.创建数据库 #启动数据库服务: [root@node3 ~]# systemctl start mariadb #进入数据库,创建数据库,并授权:
7.访问wordpress #域名解析
#效果
#创建了缓存文件 [root@node3 html]# cat /usr/local/nginx/html/wordpress/wp-config.php
8.创建discuz虚拟主机配置文件 [root@node3 src]# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/vhost/bbs.net.conf #修改配置文件 [root@node3 src]# vim /usr/local/nginx/conf/vhost/bbs.net.conf
9.上传网站代码 #解压: [root@node3 src]# unzip Discuz_X3.1_SC_UTF8.zip -d /usr/local/nginx/html/ #授权:授予nginx用户处理upload [root@node3 src]# chown nobody. -R /usr/local/nginx/html/upload/
[root@node3 ~]# /usr/local/nginx/sbin/nginx -s reload
10.创建数据库:
11.访问discuz
|