返回顶部
首页 > 资讯 > 数据库 >基于Nginx1.22+PHP8+MySQL8安装Discuz! X3.5
  • 607
分享到

基于Nginx1.22+PHP8+MySQL8安装Discuz! X3.5

php服务器linuxmysqlnginx 2023-09-12 15:09:45 607人浏览 八月长安
摘要

基于Nginx1.22+PHP8+Mysql8安装Discuz! X3.5 1. 安装PHP82. 安装MySQL83. 配置Nginx1.224. 安装Discuz! X3.5 1. 安

基于Nginx1.22+PHP8+Mysql8安装Discuz! X3.5

1. 安装php8

  更新系统:

yum update

  安装EPEL存储库:

yum install epel-release

  安装Remi存储库(提供了最新的 PHP 版本):

yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

  启用Remi存储库中的PHP8:

yum install yum-utilsyum-config-manager --enable remi-php80

  安装PHP 8和相关扩展:

yum install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-JSON

  验证PHP安装:

php -vPHP 8.0.29 (cli) (built: Jun  7 2023 17:25:45) ( NTS GCc x86_64 )Copyright (c) The PHP GroupZend Engine v4.0.29, Copyright (c) Zend Technologies

  配置和启动PHP-FPM:

systemctl enable php-fpmsystemctl start php-fpm
ss -tNLP | grep 9000LISTEN     0      128    127.0.0.1:9000                     *:*                   users:(("php-fpm",pid=913,fd=9),("php-fpm",pid=912,fd=9),("php-fpm",pid=911,fd=9),("php-fpm",pid=910,fd=9),("php-fpm",pid=909,fd=9),("php-fpm",pid=908,fd=7))

2. 安装Mysql8

  安装编译所需的依赖项:

yum install -y gcc-c++ openssl  openssl-devel make bison ncurses-develyum install Centos-release-sclyum install devtoolset-11-gcc devtoolset-11-gcc-c++ devtoolset-11-binutils

  编译安装cmake3.25.3

tar xvf cmake-3.25.3.tar.gz cd cmake-3.25.3./bootstrap make && make install 
/usr/local/bin/cmake --versioncmake version 3.25.3ln -s /usr/local/bin/cmake /usr/bin/cmake --versioncmake version 3.25.3

  解压并编译源代码包:

wget Https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.33.tar.gz
tar xvf mysql-8.0.33.tar.gzcd mysql-8.0.33mkdir buildcd build/

  运行CMake生成Makefile:

cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \-DMYSQL_DATADIR=/var/lib/mysql \-DWITH_INNODB_MEMCACHED=ON \-DWITH_MYISAM_STORAGE_ENGINE=1 \-DDOWNLOAD_BOOST=1 \-DWITH_BOOST=/usr/local/boostmake && make install

  将MySQL安装到 /usr/local/mysql目录,数据目录为 /var/lib/mysql,启用InnoDB Memcached插件,启用 MyISAM 存储引擎,并指定Boost库的路径

  配置MySQL:

groupadd mysqluseradd -r -g mysql -s /bin/false mysqlcd /usr/local/mysqlchown -R mysql:mysql .bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql

  设置MySQL开机自启动:

cp support-files/mysql.server /etc/init.d/mysqlchkconfig --add mysqlchkconfig mysql on
cat /etc/my.cnf[mysqld]datadir=/var/lib/mysqllog-error=/var/lib/mysql/mysql.logpid-file=/var/lib/mysql/mysql.pidSocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Settings user and group are ignored when systemd is used.# If you need to run mysqld under a different user or group,# customize your systemd unit file for mariadb according to the# instructions in http://fedoraproject.org/wiki/Systemd[mysqld_safe]log-error=/var/lib/mysql/mysql.logpid-file=/var/lib/mysql/mysql.pidsocket=/tmp/mysql.sock## include all files from the config directory#!includedir /etc/my.cnf.d

  启动MySQL服务:

systemctl restart mysqlsystemctl status mysql

  进行安全性配置:

/usr/local/mysql/bin/mysql_secure_installation
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql -u root -pEnter passWord: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 12Server version: 8.0.33 Source distributionCopyright (c) 2000, 2023, oracle and/or its affiliates.Oracle is a reGIStered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> mysql> update user set host = '%' where user = 'root';mysql> flush privileges;

3. 配置Nginx1.22

  Nginx1.22的安装与配置可参考我的其他博客文章

/usr/local/nginx/sbin/nginx -vnginx version: nginx/1.22.0
   location / {        root   html;        index  index.php index.html index.htm;    }              location ~ \.php$ {            root           html;            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;            include        fastcgi_params;        }

  /usr/local/nginx/html为网站发布目录,我的为/usr/local/nginx/html

cat /usr/local/nginx/html/index.php <?php    echo phpinfo();  ?>

在这里插入图片描述

4. 安装Discuz! X3.5

  Discuz! X3.5官网站点

unzip Discuz_X3.5_SC_UTF8_20230520.zip

  解压缩得到如下三个文件:
  upload这个目录下面的所有文件是我们需要上传到服务器上的可用程序文件
  readme目录为产品介绍、授权、安装、升级、转换以及版本更新日志说明
  utility目录为论坛附带工具,包括升级程序

  将upload这个目录下的所有文件上传到/usr/local/nginx/html目录

cp -r ./upload/* /usr/local/nginx/html/
cd /usr/local/nginx/html/chmod 757  -R  data/  uc_server/  config/  uc_client/

在这里插入图片描述
 
在这里插入图片描述
 
在这里插入图片描述
 
在这里插入图片描述
 
在这里插入图片描述
 
在这里插入图片描述

来源地址:https://blog.csdn.net/wangzongyu/article/details/131316912

您可能感兴趣的文档:

--结束END--

本文标题: 基于Nginx1.22+PHP8+MySQL8安装Discuz! X3.5

本文链接: https://www.lsjlt.com/news/404729.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作