centos7.2搭建smartwiki

搭建smartwiki需要四个组件

  1. nginx
  2. php
  3. msyql
  4. smartwiki源码

参考资料:

源码地址:https://github.com/lifei6671/SmartWiki
smartwiki官网:https://www.iminho.me/

首先搭建php环境

检查当前环境是否有php

yum list installed | grep php

如果有安装的PHP包,先删除他们
 yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
下载PHP软件仓库:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
(如果想删除上面安装的包,重新安装  可以rpm -qa | grep webstatic 然后 rpm -e  上面搜索到的包即可)
安装php包
 yum -y install php56w.x86_64 php56w-cli.x86_64 php56w-common.x86_64 php56w-gd.x86_64 php56w-ldap.x86_64 php56w-mbstring.x86_64 php56w-mcrypt.x86_64 php56w-mysql.x86_64 php56w-pdo.x86_64
安装php-fpm
yum -y install php56w-fpm
查看php版本
php -v
到这里php环境就搭建好了,php-fpm是什么呢?FPM(FastCGI 进程管理器)用于替换PHP FastCGI 的大部分附加功能,对于高负载网站是非常有用的。

启动php-fpm
/usr/sbin/php-fpm
lsof -i:9000 查看是否启动
安装smartwiki

下载源码

git clone -b release https://github.com/lifei6671/SmartWiki.git

设置目录权限

在 SmartWiki 根目录执行

sudo chmod -R 0777 storage
sudo chmod -R 0777 public
sudo chmod -R 0777 vendor

添加配置文件并设置加密密钥

生成配置文件

mv .env.example .env

设置配置文件权限

sudo chmod 0777 .env

生成加密密钥

php artisan key:generat
nginx配置安装
yum -y install nginx

vim /etc/nginx/nginx.conf

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

server {
    listen       80;
    server_name  wiki.puhuijia.com;
    charset      utf-8;
    set $root_path '/smartwiki/SmartWiki/public';
    root $root_path;
    try_files $uri $uri/ @rewrite;
    index index.php index.html;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
 
    location ~ \.php$ {
        fastcgi_index  index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
 
    location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
        root $root_path;
    }
}
}

重启nginx

service nginx restart
安装mysql

我们使用yum的方式来安装mysql5.7

下载安装包仓库:

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

然后进行repo的安装

rpm -ivh mysql57-community-release-el7-9.noarch.rpm

安装mysql

yum -y install mysql-server

启动关闭

systemctl start mysqld #启动MySQL
systemctl stop mysqld #关闭MySQL
systemctl restart mysqld #重启MySQL
systemctl status mysqld #查看MySQL运行状态
systemctl enable mysqld #设置开机启动
systemctl disable mysqld #关闭开机启动

查看初始密码:

grep 'temporary password' /var/log/mysqld.log

登录

mysql -uroot -p

初次修改root密码

set global validate_password_policy=0;

取消密码长度限制

ALTER USER USER() IDENTIFIED BY '12345678';

至此smartwiki搭建成功,浏览器输入IP/index.php进行后续设置。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 135,864评论 19 139
  • 更改ip和dnsVi /etc/sysconfig/network-scripts/ifcfg-eth0vi /...
    Xwei_阅读 5,865评论 0 3
  • 1.写在前面 本文主要介绍的是zabbix的编译安装过程,包含它的基础环境LNMP,虽然zabbix官方一般推荐的...
    天之蓝色阅读 7,338评论 0 16
  • “新学期,我要进行课堂教学改革!”这样说的时候,我是认真滴。 十几年的教学经验,不能说自己在驾驭课堂、驾驭教材方面...
    万年青_7c89阅读 3,134评论 1 0
  • 暗恋是一片云,有时侯恰似你的温柔,更恰似你的纠结。在暗恋的海洋中敖游,似乎看不到彼岸,但能看到希望。 当...
    品味与震撼阅读 3,744评论 3 9

友情链接更多精彩内容