注意事项:
修改nginx配置文件,启动nginx服务,修改php配置文件,启动php-fpm服务(9000)
(1)关闭防火墙关闭增强功能
yum -y install pcre-devel zlib-devel gcc gcc-c++ make
(3)设置不能登录nginx的用户
useradd -M -s /sbin/nologin nginx
(4)下载软件包并解压到当前文件夹
(5)编译安装
cd nginx-1.12.2/
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_stub_status_module
make -j3 && make install
(6)创建一个软连接把nginx映射成系统命令
ln -s /usr/local/nginx/sbin/nginx /usr/local/sbin/
检查下配置文件 nginx -t
给nginx服务文件授权并设置开机自启
(8)启动nginx服务并查看端口占用情况
(9)查看网页
(1)1.安装环境依赖包
yum install -y gcc gcc-c++ ncurses ncurses-devel bison cmake
(2).创建运行程序用户
(3)切换到mysql-boost-5.7.20.tar.gz 目录下。配置软件模块编译安装
(4) 编译安装make -j3 && make install
(5) 修改mysql配置文件
Vim /etc/my.conf
[client]
port = 3306
socket=/usr/local/mysql/mysql.sock
[mysqld]
user = mysql
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
port = 3306
character-set-server=utf8
pid-file = /usr/local/mysql/mysqld.pid
socket=/usr/local/mysql/mysql.sock
bind-address = 0.0.0.0
skip-name-resolve
max_connections=2048
default-storage-engine=INNODB
max_allowed_packet=16M
server-id = 1
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,PIPES_AS_CONCAT,ANSI_QUOTES'
( 6)更改mysql安装目录和配置文件的属主、属组
(7)设置路径环境变量
echo 'export PATH=/usr/local/mysql/bin:/usr/local/mysql/lib:$PATH' >> /etc/profile
source /etc/profile
(8)初始化数据库
(9)添加mysql系统服务
cp /usr/local/mysql/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/ #用于systemctl服务管理
systemctl daemon-reload #刷新识别
systemctl start mysqld.service #开启服务
systemctl enable mysqld #开机自启动
netstat -anpt | grep 3306 #查看端口
(10)修改mysql登陆密码
mysqladmin -u root -p password "123456" #给root账号设置密码为123456,提示输入的是原始密码(为空)
(11)授权远程登陆
mysql -u root -p
grant all privileges on *.* to 'root'@'%' identified by 'abc123';
#授予root用户可以在所有终端远程登录,使用的密码是abc123,并对所有数据库和所有表有操作权限
show databases; #查看当前已有的数据库
(1)安装GD库和GD库关联程序,用来处理和生成图片
yum install -y \
> gd \
> libjpeg libjpeg-devel \
> libjpng libpng-devel \
> freetype freetype-devel \
> libxml2 libxml2-devel \
> zlib zlib-devel \
> curl curl-devel \
> openssl openssl-devel
(2)配置软件模块
cd /opt
tar zxvf php-7.1.24.tar.gz
cd /opt/php-7.1.24/
./configure \
--prefix=/usr/local/php \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip
(3)编译及安装
make -j3 && make install
(4)复制模版文件作为PHP 的主配置文件,并进行修改
cp /opt/php-7.1.24/php.ini-development /usr/local/php/lib/php.ini
vim /usr/local/php/lib/php.ini
--1170行--修改
mysqli.default_socket = /usr/local/mysql/mysql.sock
--939行--取消注释,修改
date.timezone = Asia/Shanghai
(5)优化把PHP 的可执行程序文件放入路径环境变量的目录中便于系统识别
ln -s /usr/local/php/bin/* /usr/local/bin/
php -m #查看PHP 加载了哪些模块
(6)进程服务配置文件
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
17去掉注释 pid = run/php-fpm.pid
(7)扩展配置文件:www.conf
cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf
(8)启动php-fpm
ln -s /usr/local/php/sbin/* /usr/local/sbin
/usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini
netstat -anpt | grep 9000
(9)修改nginx服务的配置文件,让nginx支持PHP
vim /usr/local/nginx/conf/nginx.conf
--65行--取消注释,修改
65 location ~ \.php$ {'
66 root html;'
67 fastcgi_pass 127.0.0.1:9000;'
68 fastcgi_index index.php;'
69 fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;'
70 include fastcgi_params;'
71 }'
systemctl restart nginx.service
echo '' > /usr/local/nginx/html/index.php
(1)创建一个数据库
mysql -u root -p
mysql> CREATE DATABASE bbs;
#把bbs数据库里面所有表的权限授予给bbsuser,并设置密码
mysql> GRANT all ON bbs.* TO 'bbsuser'@'%' IDENTIFIED BY '123456';
#刷新数据库
mysql>flush privileges;
(2)解压论坛压缩包
unzip Discuz_X3.4_SC_UTF8.zip -d /opt/dis
(3)上传站点更新包
cd /opt/dis/dir_SC_UTF8/
cp -r upload/ /usr/local/nginx/html/bbs/ #将论坛程序拷贝到nginx/html下
(4)更改论坛目录属主
#切换论坛目录
#更改论坛目录属主(httpd安装若改配置文件为apache,则下方命令将daemon改为apache,并创建apache用户)
cd /usr/local/nginx/html/bbs/
chmod -R 777 ./config/
chmod -R 777 ./data/
chmod -R 777 ./uc_client/
chmod -R 777 ./uc_server/
(5)验证是否能登陆并注册用户
论坛安装页面为:192.168.154.19/bbs/install/index.php
网页访问地址为:192.168.154.19/bbs/index.php
管理员登录
创建新用户