栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux搭建lnmp并部署WeCenter博客

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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

重启nginx服务,进行测试

10.将下载好的源码传入Linux
我这里采用的是cmd里面的scp
scp <文件名> root@:/      <你要传入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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/296456.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号