自学内容网 自学内容网

inmp+discuz论坛

inmp的概念

建立discuz论坛

测试nginx是否正常

systemctl restart nginx.service 

安装以下软件包

解压mysql软件包

tar -xf mysql-8.0.30-el7-x86_64.tar.gz 
重命名文件
 mv mysql-8.0.30-el7-x86_64.tar.gz mysql

将mysql移动到/usr/local
mv mysql /usr/local
创建mysql程序用户
 useradd -s /sbin/nologin mysql
修改所有者和所在组
chown mysql.mysql -R /usr/local/mysql/

在etc目录下添加mysql的主配置文件
vim /etc/my.cnf 
[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 = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
修改配置文件所有者和所在组
chown mysql.mysql /etc/my.cnf 
让系统能够识别mysql命令
echo "PATH+$PATH:/usr/local/mysql/bin" >> /etc/profile
source /etc/profile

建立数据库

cd /usr/local/mysql/bin/
./mysqld \
--initialize-insecure \
--user=mysql \
--basedir=/usr/local/mysql \
--datadir=/usr/local/mysql/data
cd /usr/local/mysql/support-files/
cp mysql.server /etc/init.d/mysqld 
赋权并重启
chmod +x /etc/init.d/mysqld 
systemctl daemon-reload
systemctl restart mysqld
检查端口是否开启
创建数据库密码

配置数据库
create user 'root'@'%' identified by '123456';
CREATE DATABASE bbs;

CREATE USER 'bbsuser'@'%' IDENTIFIED BY 'admin123';
GRANT ALL PRIVILEGES ON bbs.* TO 'bbsuser'@'%';
FLUSH PRIVILEGES;

CREATE USER 'bbsuser'@'localhost' IDENTIFIED BY 'admin123';
GRANT ALL PRIVILEGES ON bbs.* TO 'bbsuser'@'localhost';
FLUSH PRIVILEGES;

安装php

tar -xf php-8.1.27
apt-get install -y libgd-dev libjpeg8-dev libpng-dev libfreetype6-dev libxml2-dev zlib1g-dev libcurl4-openssl-dev libssl-dev libonig-dev libsqlite3-dev
groupadd nobody
make -j 4 && make install
cd /opt/php-8.1.27/
./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-pdo-mysql \
--with-openssl \
--with-sqlite-devel \
--with-oniguruma-devel \
--enable-fpm \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip

做软链接

ln -s /usr/local/php/bin/* /usr/local/bin/
ln -s /usr/local/php/sbin/* /usr/local/sbin/
cp php.ini-development /usr/local/php/lib/php.ini

修改配置

cd /usr/local/php/lib
vim php.ini 

修改进程服务端的配置文件

cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf

扩展配置文件

cd /usr/local/php/etc/php-fpm.d
cp www.conf.default www.conf

启动php端口服务

/usr/local/php/sbin/php-fpm -c /usr/local/php/lib/php.ini 

检查端口是否启用

cd /opt/php-8.1.27/sapi/fpm/

复制系统管理文件到/usr/lib/systemd/system/目录下,让系统识别

cp php-fpm.service /usr/lib/systemd/system/php-fpm.service 
启动服务
systemctl restart php-fpm.service 
查看日志检查是否成功启动

显示”只读“报错,则更换主配置文件路径

配置nginx

cd /usr/local/nginx/conf

在修改重要配置文件前建议先备份

解压Discuz

unzip Discuz_X3.5_SC_UTF8.zip -d /opt/dis

同样复制并赋权

如显示不可写更改文件目录即可

成功访问


原文地址:https://blog.csdn.net/TianyaOAO/article/details/144348461

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!