一.环境搭载
1.安装依赖包
yum -y install pcre-devel zlib-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel
2.源码编译安装nginx
cd /usr/local/src
wget /download/nginx-1.26.
useradd -r -M -s /sbin/nologin www
tar zxf nginx(tab)
cd nginx(tab)
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_random_index_module --with-http_stub_status_module
make && make install
cd /usr/local/nginx/sbin
./nginx
ss -antlp |grep nginx (防火墙策略:firewall-cmd --add-port=80/tcp)
3.源码安装mysql
wget /get/
rpm -ivh mysql(tab)
vim /etc//
(安装8.0版本)
rpm - e mariadb-libs --nodeps
yum -y install mysql-server
systemctl start mysql
mysql -uroot -p初始密码
(查看初始密码:grep password /var/log/)
alter user root@localhost identified by 'Test123@com';
quit
包编译安装php
cd /usr/local/src
导入所需的php、libmcrypt的rpm包
(1)rpm编译安装libmcrypt
tar zxf libmcrypt(tab)
cd libmcrypt(tab)
./configure --prefix=/usr/local/libmcrypt && make && make install
(2)rpm编译安装php
tar zxf php(tab)
cd php(tab)
./configure --prefix=/usr/local/php5.6 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-fpm --enable-sockets --enable-sysvshm --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --with-mhash --with-mcrypt=/usr/local/libmcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/ --with-bz2 --enable-maintainer-zts
make && make install
(3)配置php启动文件
cp -production /etc/
cp sapi/fpm/-fpm /etc//php-fpm
chmod +x /etc//php-fpm
cp /usr/local/php(tab)/etc/ /usr/local/php(tab)/etc/
vim /usr/local/php(tab)/etc/
pid = run/
listen = 127.0.0.1:9000
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
/etc//php-fpm start
二、LNMP部署
1.检查服务
ss -antlp |grep nginx
ss -antlp |grep mysqld
ss -antlp|grep php-fpm
2.配置nginx
vim /usr/local/nginx/conf/
location解析php
cd /usr/local/nginx/html
vim index,php
nginx -s reload
3.搭建Discuz环境
cd /usr/local/src
mkdir Discuz
cd Discuz
导入所需要的zip包
unzip Discuz(tab)
mv upload /usr/local/nginx/html/bbs
cd /usr/local/nginx/html/bbs
chown -R nobody:nobody ./data ./config
chown -R nobody:nobody ./uc_server
chown -R nodody:nobody ./uc_client/data/cache
4.安装Discuz
(1)创建数据库账户
mysql -uroot -pTest123@com
create user mydis@localhost identified by 'Test123@com';
grant all on ultrax.* to mydis@localhost;
quit
mysql -umydis -pTest123@com
create database ultrax charset utf8;
quit
(2)数据库认证
vim /etc/
systemctl restart mysqld
mysql -uroot -pTest123@com
(3)登录html