Skip to content

CentOS Installation(Nginx)

lxerxa edited this page May 19, 2020 · 11 revisions

CentOS 7.5.1804,php7.0,root用户为例

step 1

使用EPEL源和Webtatic源安装:

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

安装Nginx:

yum -y install nginx

安装php以及相关组件。php建议安装7.0

yum -y install php70w php70w-fpm php70w-mbstring php70w-gd php70w-mcrypt php70w-curl php70w-dom php70w-ldap php70w-pecl-mongodb php70w-mysql

step 2

安装mongodb(>=3.0),3.4版本安装可参考如下:

vi /etc/yum.repos.d/mongodb-org-3.4.repo

然后复制下面配置,保存退出

[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc  

yum -y install mongodb-org

启动mongodb:

service mongod start

创建数据库和用户:

mongo actionviewdb --eval "db.createUser({ user: 'actionview', pwd: 'secret', roles: [ { role: 'readWrite', db: 'actionviewdb' } ] });"

step 3

下载程序:

cd /var/www/
git clone https://github.com/lxerxa/actionview.git actionview

安装依赖:

cd actionview
cp composer.phar /usr/local/bin/composer (如果composer已安装请忽略此步)
composer install --no-dev

执行配置脚本:

sh config.sh

修改数据库连接参数,在拷贝后的.env文件中,示例如下:

cp .env.example .env

DB_HOST=127.0.0.1
DB_DATABASE=actionviewdb
DB_USERNAME=actionview
DB_PASSWORD=secret

执行db数据初始化脚本:

mongorestore -h 127.0.0.1 -u actionview -p secret -d actionviewdb --drop ./dbdata

配置nginx:

server {
    listen 80;
    listen [::]:80;

    root /var/www/actionview/public;

    server_name localhost;

    client_max_body_size 100M;

    location ^~ /actionview/api {
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.php$is_args$args;
    }

    location ^~ /actionview {
        add_header Cache-Control 'no-cache, must-revalidate, max-age=0';
        alias /var/www/actionview/public/;
        index index.html index.htm index.php;
        try_files $uri $uri/ /index.html$is_args$args;
    }

    location / {
       add_header Cache-Control 'no-cache, must-revalidate, max-age=0';
       index index.html index.htm index.php;
    }

    location ~ /\.ht {
        deny all;
    }

    location ~ \.php {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        include        fastcgi_params;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name;
        try_files $uri =404;
    }
}

重新启动nginx和php-fpm:

service php-fpm stop
service php-fpm start
service nginx stop
service nginx start

step 4

安装完成,祝好运!
访问系统: http://xxx.xxx.xxx.xxx/actionview, 管理员登录: user: [email protected], password: actionview

step 5

先不要着急,再做最后一步配置,以便能发mail通知、为燃尽图展示提供数据、自动同步LDAP用户数据。

crontab里添加:

* * * * * php /var/www/actionview/artisan schedule:run >> /dev/null 2>&1

重新启动cron服务:

service crond restart

Clone this wiki locally