当前位置: 首页 > news >正文

【LNMP平台架构】之Discuz站点搭建

一、依赖评估

1、查询系统适配的PHP版本

[root@localhost ~]# yum list | grep php
flamegraph-stackcollapse-php.noarch                     1.0-1.oe2403sp1                                      everything   
php.src                                                 8.3.24-1.oe2403sp1                                   update-source
php.x86_64                                              8.3.24-1.oe2403sp1                                   update    

2、下载Discuz软件包

3、安装php、php插件、nginx和mysql

[root@localhost ~]# yum  install -y php php-mysqlnd nginx mysql-server

Nginx 服务器中用于配置 PHP 脚本处理规则的配置文件

[root@localhost nginx]# cd default.d/
[root@localhost default.d]# ls
php.conf
[root@localhost default.d]# cat php.conf 
# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
#
index index.php index.html index.htm;location ~ \.(php|phar)(/.*)?$ {fastcgi_split_path_info ^(.+\.(?:php|phar))(/.*)$;fastcgi_intercept_errors on;fastcgi_index  index.php;include        fastcgi_params;fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;fastcgi_param  PATH_INFO $fastcgi_path_info;fastcgi_pass   php-fpm;
}

Nginx 中用于定义 PHP-FPM 后端服务地址的配置文件

[root@localhost nginx]# cd conf.d/
[root@localhost conf.d]# ls
php-fpm.conf
[root@localhost conf.d]# cat php-fpm.conf 
# PHP-FPM FastCGI server
# network or unix domain socket configurationupstream php-fpm {server unix:/run/php-fpm/www.sock;
}

4、启动php、mysql和nginx

root@localhost ~]# systemctl enable --now php-fpm
Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service.
[root@localhost ~]# ps aux |grep php-fpm
root       26488  0.3  1.9 195748 27952 ?        Ss   19:27   0:00 php-fpm: master process (/etc/php-fpm.conf)
apache     26489  0.0  0.8 196300 12820 ?        S    19:27   0:00 php-fpm: pool www
apache     26490  0.0  0.8 196300 12820 ?        S    19:27   0:00 php-fpm: pool www
apache     26491  0.0  0.8 196300 12820 ?        S    19:27   0:00 php-fpm: pool www
apache     26492  0.0  0.8 196300 12820 ?        S    19:27   0:00 php-fpm: pool www
apache     26493  0.0  0.8 196300 12824 ?        S    19:27   0:00 php-fpm: pool www
root       26657  0.0  0.5  21988  8004 pts/0    S+   19:27   0:00 grep --color=auto php-fpm[root@localhost ~]# systemctl enable --now mysqld
Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service.
[root@localhost ~]# systemctl enable --now nginx
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service.

5、创建php解析文件、mysql连接解析文件

[root@localhost ~]# cd /usr/share/nginx
[root@localhost nginx]# ls
html  modules
[root@localhost nginx]# cd html/
[root@localhost html]# ls
404.html  50x.html  index.html  nginx-logo.png
[root@localhost html]# vim test.php<?phpphpinfo();
?>
[root@localhost html]# vim mysql_conn.php
<?php#连接数据库$link = mysqli_connect('localhost','root','');#检查连接if ($link) {echo "OK!";} else {echo "NO!";}mysqli_close($link);
?>

6、测试

7、解压Discuz软件包并拷贝upload

[root@localhost ~]# cd DiscuzX-MitFrame/
[root@localhost DiscuzX-MitFrame]# ls
developer  README.md  upload
[root@localhost DiscuzX-MitFrame]# cp -r upload/ /usr/share/nginx/html
[root@localhost DiscuzX-MitFrame]# cd /usr/share/nginx/html
[root@localhost html]# ls
404.html  50x.html  index.html  mysql_conn.php  nginx-logo.png  test.php  upload

测试

8、创建数据库用户并赋权

mysql> create user discuz@'localhost' identified by '123.com';
Query OK, 0 rows affected (0.05 sec)mysql> grant all on discuzdb.* to discuz@'localhost';
Query OK, 0 rows affected (0.00 sec)

9、更改upload目录权限

[root@localhost html]# chown -R apache upload/
[root@localhost html]# ls -l
总计 28
-rw-r--r--.  1 root   root 3454  9月 4日 18:27 404.html
-rw-r--r--.  1 root   root 3497  9月 4日 18:27 50x.html
-rw-r--r--.  1 root   root 3510  9月 4日 18:27 index.html
-rw-r--r--.  1 root   root  175 10月21日 20:11 mysql_conn.php
-rw-r--r--.  1 root   root  368  9月 4日 18:27 nginx-logo.png
-rw-r--r--.  1 root   root   21 10月21日 19:43 test.php
drwxr-xr-x. 12 apache root 4096 10月21日 20:15 upload

10、完成Discuz搭建

http://www.dtcms.com/a/512693.html

相关文章:

  • YOLOv4 全面解析:核心改进、数据增强与网络架构
  • 网页开发一:设计登录页
  • 智能网站搭建平台湛江网站建设湛江
  • 设计师网站推荐做网站里面的图片像素要求
  • C语言需要掌握的基础知识点之数组
  • DeepSeek-OCR可能成为开启新时代的钥匙
  • C++11:可变参数模板,lambda,function包装器
  • 商城网站建设要多少钱域名备案查询最新消息
  • 企业网站优化的方式我的家乡ppt模板免费下载
  • 算法-每日一题(DAY18)多数元素
  • 清远专业网站建设服务阿里云个人网站制作
  • 河北省保定市唐县城乡建设网站wordpress仿异次元下载页
  • springboot优雅停止的流程梳理
  • 音视频开发远端未发布视频占位图
  • 贵阳网站开发推荐你的网站赚钱吗
  • 上海备案证查询网站查询网站查询系统桂林论坛网站建设
  • QT6中三种设置控件及窗口大小的函数
  • 现在的网站前端用什么做综合返利商城网站建设
  • 河南省建设厅网网站首页没备案的网站收录
  • 织梦网站标题被改学校招生网络营销方案
  • 从0到1:如何用统计学“看透”不同睡眠PSG数据集的差异(域偏差分析实战)
  • 如何做淘宝优惠卷网站网站业务员怎么给客户做方案
  • 网站空间后台登录长沙seo服务
  • 灵敏度、稳定性、便携性三重突破——小吉BL-08plus为何成禽病防控新标配?
  • ubuntu 中使用 lftp 命令行工具传输文件
  • 推荐5款中文打字速度测试软件:无需下载即可使用
  • 网站建设基础服务wordpress polling
  • 长春 网站 设计公司wordpress 权限
  • 什么在线做动图的网站比较好织梦调用wordpress
  • 用 Python 给 Amazon 做“全身 CT”——可量产、可扩展的商品详情爬虫实战