重庆网站seo服务,为什么网站打不开首页,做app网站需要什么技术,TP5.1做的网站首页被挂马原因文章目录 LNMP架构部署Discuz论坛系统部署LNMP架构环境前期准备安装Nginx安装mariadb安装php配置nginx 部署Discuz论坛系统下载Discuz论坛系统代码包部署Discuz论坛系统配置虚拟主机安装Discuz论坛访问站点尝试注册一个账号 LNMP架构部署Discuz论坛系统
部署LNMP架构… 文章目录 LNMP架构部署Discuz论坛系统部署LNMP架构环境前期准备安装Nginx安装mariadb安装php配置nginx 部署Discuz论坛系统下载Discuz论坛系统代码包部署Discuz论坛系统配置虚拟主机安装Discuz论坛访问站点尝试注册一个账号 LNMP架构部署Discuz论坛系统
部署LNMP架构
环境
操作系统Nginx版本数据库版本PHP版本centos-8nginx-1.22.1mariadb-10.3php-8.2.10 前期准备
//配置yum源推荐使用阿里云源和epel源
[rootwanf ~]# rm -rf /etc/yum.repos.d/*
[rootwanf ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
[rootwanf ~]# sed -i -e /mirrors.cloud.aliyuncs.com/d -e /mirrors.aliyuncs.com/d /etc/yum.repos.d/CentOS-Base.repo
[rootwanf ~]# yum clean all
[rootwanf ~]# yum makecache
[rootwanf ~]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
[rootwanf ~]# sed -i s|^#baseurlhttps://download.example/pub|baseurlhttps://mirrors.aliyun.com| /etc/yum.repos.d/epel*
[rootwanf ~]# sed -i s|^metalink|#metalink| /etc/yum.repos.d/epel*
[rootwanf ~]# yum makecache //永久关闭防火墙和selinux
[rootwanf ~]# systemctl disable --now firewalld.service
[rootwanf ~]# setenforce 0
[rootwanf ~]# sed -i s/^SELINUXenforcing/SELINUXdisabled/g /etc/selinux/config
[rootwanf ~]# reboot//安装相关依赖
[rootwanf ~]# yum -y install libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel php-mysqlnd sqlite-devel libzip libzip-devel gd-devel oniguruma make wget vim --nobest[rootwanf ~]# yum -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm[rootwanf ~]# yum -y install gcc gcc-c --allowerasing
[rootwanf ~]# yum -y groups mark install Development Tools安装Nginx
//创建nginx系统用户
[rootwanf ~]# useradd -r -M -s /sbin/nologin nginx
[rootwanf ~]# id nginx
uid995(nginx) gid992(nginx) groups992(nginx)//创建日志存放目录
[rootwanf ~]# mkdir -p /var/log/nginx
[rootwanf ~]# chown -R nginx.nginx /var/log/nginx//下载nginx软件包并安装
[rootwanf ~]# wget http://nginx.org/download/nginx-1.22.1.tar.gz -P /usr/src///编译安装
[rootwanf ~]# cd /usr/src/
[rootwanf src]# ls
debug kernels nginx-1.22.1.tar.gz
[rootwanf src]# tar -xf nginx-1.22.1.tar.gz
[rootwanf src]# cd nginx-1.22.1/
[rootwanf nginx-1.22.1]# ./configure \
--prefix/usr/local/nginx \
--usernginx \
--groupnginx \
--with-debug \
--with-http_ssl_module \
--with-http_realip_module \
--with-http_image_filter_module \
--with-http_gunzip_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--http-log-path/var/log/nginx/access.log \
--error-log-path/var/log/nginx/error.log
配置过程省略[rootwanf nginx-1.22.1]# make -j4 make install
编译安装过程省略//nginx安装后配置
//配置环境变量
[rootwanf ~]# echo export PATH/usr/local/nginx/sbin:$PATH /etc/profile.d/nginx.sh
[rootwanf ~]# source /etc/profile.d/nginx.sh//加入systemctl管理
[rootwanf ~]# vim /usr/lib/systemd/system/nginx.service
[rootwanf ~]# cat /usr/lib/systemd/system/nginx.service
[Unit]
Descriptionnginx server daemon
Afternetwork.target[Service]
Typeforking
ExecStart/usr/local/nginx/sbin/nginx
ExecStop/usr/local/nginx/sbin/nginx -s stop
ExecReload/usr/local/nginx/sbin/nginx -s reload[Install]
WantedBymulti-user.target
[rootwanf ~]# systemctl daemon-reload //启动并设置开机自启
[rootwanf ~]# systemctl enable --now nginx.service
[rootwanf ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 511 0.0.0.0:80 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
[rootwanf ~]# 成功访问nginx主页 安装mariadb
//安装mariadb
[rootwanf ~]# yum -y install mariadb mariadb-server//启动mariadb并设置开机自启
[rootwanf ~]# systemctl enable --now mariadb.service //设置密码
[rootwanf ~]# mysql
MariaDB [(none)] set password password(12345678); //根据需求设置密码
Query OK, 0 rows affected (0.001 sec)MariaDB [(none)] quit
Bye
[rootwanf ~]# 安装php
//下载php软件包
[rootwanf ~]# wget https://www.php.net/distributions/php-8.2.10.tar.gz -P /usr/src///编译安装
[rootwanf ~]# cd /usr/src/
[rootwanf src]# tar -xf php-8.2.10.tar.gz
[rootwanf src]# cd php-8.2.10/
[rootwanf php-8.2.10]# ./configure --prefix/usr/local/php8 \
--with-config-file-path/etc \
--enable-fpm \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-openssl \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--enable-exif \
--enable-ftp \
--enable-gd \
--with-jpeg \
--with-zlib-dir \
--with-freetype \
--with-gettext \
--enable-mbstring \
--enable-pdo \
--with-mysqlimysqlnd \
--with-pdo-mysqlmysqlnd \
--with-readline \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--with-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-pcntl \
--enable-posix
配置过程省略[rootwanf php-8.2.10]# make -j4 make install
编译安装过程省略//安装后配置
[rootwanf php-8.2.10]# echo export PATH/usr/local/php8/bin:$PATH /etc/profile.d/php8.sh
[rootwanf php-8.2.10]# source /etc/profile.d/php8.sh
[rootwanf php-8.2.10]# cp php.ini-production /etc/php.ini
cp: overwrite /etc/php.ini? y
[rootwanf php-8.2.10]# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
[rootwanf php-8.2.10]# chmod x /etc/rc.d/init.d/php-fpm
[rootwanf php-8.2.10]# cp /usr/local/php8/etc/php-fpm.conf.default /usr/local/php8/etc/php-fpm.conf
[rootwanf php-8.2.10]# cp /usr/local/php8/etc/php-fpm.d/www.conf.default /usr/local/php8/etc/php-fpm.d/www.conf
[rootwanf php-8.2.10]# vim /usr/local/php8/etc/php-fpm.conf
[rootwanf php-8.2.10]# vim /usr/local/php8/etc/php-fpm.conf
[rootwanf php-8.2.10]# tail -4 /usr/local/php8/etc/php-fpm.conf
pm.max_children 50
pm.start_servers 5
pm.min_spare_servers 2
pm.max_spare_servers 8
[rootwanf php-8.2.10]# //加入systemctl管理
[rootwanf ~]# vim /usr/lib/systemd/system/php-fpm.service
[rootwanf ~]# cat /usr/lib/systemd/system/php-fpm.service
[Unit]
Descriptionphp-fpm server daemon
Afternetwork.targe[Service]
Typeforking
ExecStart/etc/rc.d/init.d/php-fpm start
ExecStop/etc/rc.d/init.d/php-fpm stop
ExecReload/bin/kill -HUP \$MAINPID[Install]
WantedBymulti-user.target
[rootwanf ~]# systemctl daemon-reload//启动并设置开机自启
[rootwanf ~]# systemctl enable --now php-fpm.service 配置nginx
//创建php测试页面
[rootwanf ~]# cd /usr/local/nginx/html/
[rootwanf html]# vim index.php
[rootwanf html]# cat index.php
?phpphpinfo();
?
[rootwanf html]# //修改nginx主配置文件
[rootwanf html]# vim /usr/local/nginx/conf/nginx.conf
......
server {listen 80;server_name www.wanf.com; //自己的域名
......location / {root html;index index.php index.html index.htm; //加一个index.php}
......location ~ \.php$ {root html;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;include fastcgi.conf; //改为fastcgi.conf;}
......//重启服务
[rootwanf html]# systemctl restart nginx.service 通过IP地址访问测试页面 部署完成
部署Discuz论坛系统
下载Discuz论坛系统代码包 Discuz论坛系统下载地址Discuz官网
//我提前下好了然后传进主机中
[rootwanf ~]# ls
Discuz_X3.5_SC_UTF8_20231001.zip部署Discuz论坛系统
//创建一个目录存放网站文件
[rootwanf ~]# mkdir /usr/local/nginx/html/Discuz//解压到刚刚创建的目录
[rootwanf ~]# yum -y install unzip
[rootwanf ~]# unzip Discuz_X3.5_SC_UTF8_20231001.zip -d /usr/local/nginx/html/Discuz/
[rootwanf ~]# cd /usr/local/nginx/html/
[rootwanf html]# ls
50x.html Discuz index.html index.php
[rootwanf html]# cd Discuz/
[rootwanf Discuz]# ls
LICENSE qqqun.png readme readme.html upload utility.html
[rootwanf Discuz]# cd upload/
[rootwanf upload]# ls
admin.php connect.php group.php misc.php source
api crossdomain.xml home.php plugin.php static
api.php data index.php portal.php template
archiver favicon.ico install robots.txt uc_client
config forum.php member.php search.php uc_server
[rootwanf upload]# //修改权限
[rootwanf ~]# cd /usr/local/nginx/html/Discuz/upload/
[rootwanf upload]# chown -R nginx config/
[rootwanf upload]# chown -R nginx data/
[rootwanf upload]# chown -R nginx uc_client/
[rootwanf upload]# chown -R nginx uc_server/
[rootwanf upload]# chmod -R 777 config/
[rootwanf upload]# chmod -R 777 data/
[rootwanf upload]# chmod -R 777 uc_client/
[rootwanf upload]# chmod -R 777 uc_server///创建数据库
[rootwanf ~]# mysql -uroot -p12345678 -e create database Discuz;配置虚拟主机
//编辑nginx配置文件创建一个虚拟主机可以用域名访问
[rootwanf ~]# vim /usr/local/nginx/conf/nginx.conf
.......
server {listen 80;server_name www.wanf1.com; //自己的域名location / {root html/Discuz/upload; //改为网站目录index index.php index.html index.htm;}error_page 500 502 503 504 /50x.html;location /50x.html {root html;}location ~ \.php$ {root html/Discuz/upload; //改为网站目录fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;include fastcgi.conf;}}
......//重启nginx服务和php-fpm
[rootwanf ~]# systemctl restart nginx.service
[rootwanf ~]# systemctl restart php-fpm.service 安装Discuz论坛
第一次安装需要在域名后面接/install才可以到安装界面 安装完毕 访问站点 尝试注册一个账号