Skip to content

CentOS Installation(Nginx)

asqx edited this page Dec 26, 2019 · 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):

yum -y install mongodb mongodb-server

启动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/asqx/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;

    # Add index.php to the list if you are using PHP
    index index.html index.htm index.nginx-debian.html;

    server_name localhost;

    client_max_body_size 50M;

    if (!-d $request_filename) { rewrite ^(.*)/$ /$1 permanent; }

    set $flag 0;
    if (!-e $request_filename) { set $flag 1; }
    if ($request_uri ~ ^/api) { set $flag 2; }

    if ($flag = 1) { rewrite ^(.*)$ /index.html break; }
    if ($flag = 2) { rewrite ^ /index.php break; }

    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, 管理员登录: 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