ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Linux搭建lnmp并部署WeCenter博客

2021-10-06 22:05:18  阅读:236  来源: 互联网

标签:index WeCenter lnmp nginx html Linux php php72w fastcgi


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

在这里插入图片描述

标签:index,WeCenter,lnmp,nginx,html,Linux,php,php72w,fastcgi
来源: https://blog.csdn.net/weixin_45774722/article/details/120628748

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有