1、LINUX部署
- stop firewalld
- disable selinux
2、Nginx部署
-
vim /etc/yum.repos.d/nginx.repo
[nginx-stable] name=nginx stable repo baseurl=http://nginx.org/packages/centos/$releasever/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true[nginx-mainline] name=nginx mainline repo baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/ gpgcheck=1 enabled=0 gpgkey=https://nginx.org/keys/nginx_signing.key module_hotfixes=true
-
yum install -y nginx
3、php部署
RPM部署
-
yum install -y php php-mysqlnd gd php-gd
- php-fpm:php接收动态请求的程序
- php-mysqlnd:php链接mysql的程序
- php-gd:图形库程序(GD库可以处理图片,或者生成图片)
-
systemctl restart nginx
-
systemctl enable nginx
-
mkdir -p /www/html
-
vim /www/html/index.php
测试php页面(php基本信息)
<?php phpinfo(); ?>
测试语句
-
vim /etc/nginx/conf.d/default.conf
增加PHP主页名称:index.php
server { ...location / {root /www/html;index index.php index.html index.htm;}... }
-
systemctl restart nginx
-
http://192.168.145.155/index.php
需要配置php和php-fpm关联
# find / -name php-fpm.conf
/etc/nginx/conf.d/php-fpm.conf
/etc/php-fpm.conf
/usr/lib/systemd/system/httpd.service.d/php-fpm.conf
/usr/lib/systemd/system/nginx.service.d/php-fpm.conf
# vim /etc/nginx/conf.d/php-fpm.confupstream php-fpm {server unix:/run/php-fpm/www.sock;
}复制:unix:/run/php-fpm/www.sock;
vim /etc/nginx/conf.d/default.conf
server{location / {root /www/html;index index.php index.html index.htm;}location ~ \.php$ {root /www/html;#fastcgi_pass 127.0.0.1:9000;fastcgi_pass unix:/run/php-fpm/www.sock;fastcgi_index index.php;#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;# 修改此行为正确的根目录变量fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params;}
}
4、mysql 部署
RPM部署
- wget https://dev.mysql.com/get/mysql84-community-release-el9-1.noarch.rpm
- yum install -y mysql84-community-release-el9-1.noarch.rpm
- yum install mysql-community-server -y
- systemctl start mysqld
- grep password /var/log/mysqld.log
- mysql -uroot -p’查找到的密码’
- alter user ‘root’@‘localhost’ identified by ‘Lixinyi@123’;
5、业务上线
-
购买服务器/云主机
-
购买域名&IP
-
上传APP
wget https://foruda.gitee.com/attach_file/1679018961262440635/discuz_x3.5_sc_utf8_20230316.zip?token=4df35224fad2fe04d8ce8123bf3cb65c&ts=1682306575&attname=Discuz_X3.5_SC_UTF8_20230316.zip
-
yum install -y unzip
-
rm -rf /www/html/*
-
unzip eyoucms-fuzhuang-v1.6.6.zip -d /www/html/
-
chmod -R 777 /www/html
按实际情况给权限,这里因为是实验,所以给了全部权限
- chown nginx:nginx /www -R
这里因为上面MySQL改过密码,所以使用的是MySQL中root的新密码
下面创建的是项目后台的管理员和密码
这是首页
这是后台管理页面
此时已经完成部署