标签:etc sysconf gen app 修改 技术 oca gre force
6.1.1 LAMP架构介绍
LAMP是linux、apache、mysql、php的网站架构缩写,是基于linux系统的最基础的网站架构模式,linux系统可选择centos7,web服务用apache的httpd,mysql用来存储数据,php应用程序提供前后端服务。该架构常用在一些简单的展示网站、论坛网站及博客网站上,它环境简单,易学易用,可以满足各种小网站的需求。
6.1.2 LAMP环境搭建
一 环境准备:
安装centos7.6系统,2核4G内存40G盘,最小化安装
设置好网络和防火墙 网络需要能访问外网
ip 192.168.1.103
关闭防火墙
setenforce 0
systemctl stop firewalld
systemctl disable firewalld
sed -i ‘s/enforcing/disabled/g‘ /etc/sysconfig/selinux
设置yum源
cd /etc/yum.repos.d/
yum install vim unzip lrzsz wget net-tools -y
wget http://mirrors.aliyun.com/repo/Centos-7.repo
wget http://mirrors.aliyun.com/repo/epel-7.repo
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install epel-release
二 安装httpd、php、mysql
安装httpd
[root@centos7 ~]# yum list|grep httpd
[root@centos7 ~]# yum install httpd* -y
[root@centos7 ~]# systemctl start httpd
[root@centos7 ~]# systemctl enable httpd
安装mysql
[root@centos7 ~]# yum -y install mysql-community-server
[root@centos7 ~]# systemctl start mysqld
[root@centos7 ~]# systemctl enable mysqld
[root@centos7 ~]# cat /var/log/mysqld.log|grep password
[root@centos7 ~]# 2021-01-04T09:01:21.777879Z 1 [Note] A temporary password is generated for root@localhost: ;n-<C?GfI1Vj
安装php
[root@centos7 ~]# yum install php php-fpm php-mysql -y
[root@centos7 ~]# systemctl start php-fpm
[root@centos7 ~]# systemctl enable php-fpm
查看服务
[root@centos7 ~]# netstat -lnupt
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 25545/php-fpm: master
tcp6 0 0 :::3306 :::* LISTEN 25437/mysqld
tcp6 0 0 :::80 :::* LISTEN 24700/httpd
6.1.2 discuz论坛网站
下载discuz
https://www.discuz.net/daily/
目前3.4是稳定版本,可以自己选择一个新发的构建包
wget https://www.discuz.net/data/attachment/dzxzip/DZX-SC_UTF8-v3.4-202101010500-b4759ec3.zip
unzip DZX-SC_UTF8-v3.4-202101010500-b4759ec3.zip
cp -a upload /var/www/html/discuz
chown -R apache.apache /var/www/html/discuz
创建discuz数据库
mysql -u root -p
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘Super@2020‘;
mysql> CREATE DATABASE discuz;
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘discuz‘@‘%‘ IDENTIFIED BY ‘Super@2020‘ WITH GRANT OPTION;
mysql> flush privileges;
mysql> exit
httpd.conf中配置php
vim /etc/httpd/conf/httpd.conf
找到:AddType application/x-gzip .gz .tgz在该行下面添加:
AddType application/x-httpd-php .php
找到DirectoryIndex index.html
将该行改为:DirectoryIndex index.html index.htm index.php
找到#ServerName www.example.com:80
修改为:ServerName localhost:80
重启httpd
systemctl restart httpd
浏览器打开192.168.1.103/discuz 执行安装配置discuz。
到此论坛的基础搭建完成,可以通过ip进行注册访问了。一般生产网站需要再设置一个域名供外网访问,并加上ssl证书配置,使用https方式访问。对于网站是否要设置访问控制、静态文件缓存、域名跳转、访问日志等自行根据需求配置httpd.conf即可。
标签:etc sysconf gen app 修改 技术 oca gre force
原文地址:https://www.cnblogs.com/superleedo/p/14229067.html