Linux搭建lnmp并部署WeCenter博客

Linux搭建lnmp并部署WeCenter博客

WeCenter源码链接:https://down.chinaz.com/soft/432.htm
准备环境:

  1. Linux(Centos7)
  2. PHP
  3. Nginx
  4. Mariadb

1.关闭防火墙、Selinux

service firewalld stop
set enforce 0

2.添加yum源,安装nginx

vim /etc/yum.repos.d/nginx.repo
[nginx] 
name=nginx repo 
baseurl=http://nginx.org/packages/centos/7/$basearch/ 
gpgcheck=0 
enabled=1 

保存退出

3.安装nginx

yum install -y nginx

4.安装、启动、初始化、登陆数据库

yum install -y mariadb mariadb-server
service mariadb start
mysql_secure_installation
mysql -uroot -p

5.创建一个数据库,为后续做准备

create database <库名>;

6.使用第三方扩展安装PHP7

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
yum -y install php72w php72w-cli php72w-common php72w-devel php72wembedded php72w-gd php72w-mbstring php72w-pdo php72w-xml php72w-fpm php72w-mysqlnd php72w-opcache

7.修改配置文件

vim /etc/php-fpm.d/www.conf 
user = nginx
group = nginx
#PS:保证nginx进行的管理用户和php服务进程的管理用户保持一致
service php-fpm restart
//重启服务

8.实现nginx+php关联

vim /etc/nginx/conf.d/bbb.conf

server {
  listen  80;
  server_name localhost;
  location / {
    root /usr/share/nginx/html;        //nginx网页代码存放目录
    index index.html index.php;
  }
  location ~ \.php$ {
    root /usr/share/nginx/html;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
  }
}

9.编写一个简单的测试文件

cd /usr/share/nginx/html
vim test.php     //编辑一个php配置文件
cat test.php
<?php
	phpinfo();
?>
重启nginx服务,进行测试

请添加图片描述

10.将下载好的源码传入Linux

我这里采用的是cmd里面的scp
scp <文件名> root@<Linux主机的ip>:/      <你要传入Linux的哪个位置,我就先传到/目录>

11.将下载好的wecenter源码上传到Centos7里,并且移动到/usr/share/nginx/html/里面,新建一个文件夹,方便观看。

unzip WeCenter_v3.3.0.zip  //解压此文件

在这里插入图片描述

12.创建虚拟主机文件

vim /etc/nginx/conf.d/ccc.conf
cat ccc.conf


server {
  listen  80;
  server_name localhost;
  location / {
    root /usr/share/nginx/html/we;
    index index.html index.php;
  }
  location ~ \.php$ {
    root /usr/share/nginx/html/we;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_pass 127.0.0.1:9000;
    include fastcgi_params;
  }
}
保存退出
进入/usr/share/nginx文件夹,给html文件夹下的所有文件的所属组和用户更改
chown nginx:nginx -R html
重启nginx服务
service nginx restart

在这里插入图片描述

  • 4
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
搭建自己的知乎,#WeCenter 问答系统简介 --- WeCenter 问答系统是一套开源的社交化问答软件系统。作为国内首个推出基于 PHP 的社交化问答系统,WeCenter 期望能够给更多的站长或者企业提供一套完整的社交问答系统,帮助社区或者企业搭建相关的知识库建设。 ###WeCenter 问答系统的下载 您可以随时从我们的官方下载站下载到最新版本,以及各种补丁 [http://www.wecenter.com/downloads/][1] ###WeCenter 问答系统的环境需求 1. 可用的 www 服务器,如 Apache、IIS、nginx, 推荐使用性能高效的 Apache 或 nginx. 2. PHP 5.2.2 及以上 3. MySQL 5.0 及以上, 服务器需要支持 MySQLi 或 PDO_MySQL 4. GD 图形库支持或 ImageMagick 支持, 推荐使用 ImageMagick, 在处理大文件的时候表现良好 ###WeCenter 问答系统的安装 1. 上传 upload 目录中的文件到服务器 2. 设置目录属性(windows 服务器可忽略这一步) 以下这些目录需要可读写权限 > ./ ./system ./system/config 含子目录 3. 访问站点开始安装 4. 参照页面提示,进行安装,直至安装完毕 ###WeCenter 问答系统在 Sina App Engine 安装 参见这篇文章: [http://www.wecenter.com/category/support/sae-install/][2] ### WeCenter Rewrite 开启方法 参见这篇文章: [http://www.wecenter.com/category/support/settings/][2] ### WeCenter 问答系统的升级 升级过程非常简单, 覆盖所有文件之后运行 http://您的域名/index.php?/upgrade/ 按照提示操作即可 ###WeCenter 软件的技术支持 当您在安装、升级、日常使用当中遇到疑难,请您到以下站点获取技术支持。 - 支持:http://www.wecenter.com/support/ - 讨论区:http://wenda.wecenter.com [1]: http://www.wecenter.com/downloads/ [2]: http://www.wecenter.com/category/support/sae-install/

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值