论坛搭建

摘要

Lamp 安装及论坛搭建

nginx 安装

安装依赖

1
yum -y install gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel

下载稳定版nginx

nginx.org

创建nginx管理用户

1
useradd nginx -s /sbin/nologin -M

解压到/usr/local/src,进入目录,编译

1
2
./configure --user=nginx --group=nginx --prefix=/usr/local/nginx-1.16.0/ --with-http_ssl_module --with-http_stub_status_module
make && make install

创建目录,创建软链

1
2
mkdir /data/service
ln -s /usr/local/nginx-1.16.0/ /data/service/nginx

创建开机启动文件

1
vim /usr/lib/systemd/system/nginx.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[Unit]
Description=nginx - high performance web server
Documentation=http://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx-1.16.0/logs/nginx.pid
ExecStartPre=/usr/local/nginx-1.16.0/sbin/nginx -t -c /usr/local/nginx-1.16.0/conf/nginx.conf
ExecStart=/usr/local/nginx-1.16.0/sbin/nginx -c /usr/local/nginx-1.16.0/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

创建开机自启,启动服务

1
2
systemctl enable nginx.service
systemctl start nginx.service

注意 如果修改了service文件要执行重载命令

1
systemctl daemon-reload

Mariadb

安装软件

1
yum install -y mariadb mariadb-server

启动,设置开机启动

1
2
systemctl start mariadb
systemctl enable mariadb

给root设置密码

1
mysqladmin -u root password "123456"

登录,创建论坛数据库用户和库

1
2
create database bbs;
grant all privileges on bbs.* to 'bbs'@'localhost' identified by '123456';

php

## 更新PHP软件下载源

1
2
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

PHP程序相关软件下载安装

1
yum install -y php71w php71w-cli php71w-common php71w-devel php71w-embedded  php71w-gd php71w-mcrypt php71w-mbstring php71w-pdo php71w-xml php71w-fpm php71w-mysqlnd php71w-opcache  php71w-pecl-memcached php71w-pecl-redis php71w-pecl-mongodb

PHP启动,设置开机自启动

1
2
systemctl start php-fpm
systemctl enable php-fpm

搭建论坛

下载安装包,解压

1
https://addon.dismall.com/

放置代码到域名配置的root目录下

浏览器访问配置域名

根据页面配置即可