Jitamin项目管理系统

2,059 阅读2分钟

GitHub:github.com/jitamin/jit…

安装环境要求

  • PHP 5.6或更高(推荐使用PHP7)
  • 数据库, 推荐使用MySQL 或 PostgreSQL。 当然SQLite也可以运行。
  • Composer

1. 安装lnmp

docker run -d -p 32801:80 -p 32802:443 -p 32803:3306 -p 32804:22  --name lnmp  winstonpro/lnmp
docker run -d -p 32801:80 -p 32802:3306 --restart always -v /home/jitamin/mysql/var:/usr/local/mysql/var --name lnmp_jitamin  lnmp-jitamin

2. mysql初始化密码

vim /etc/my.cnf
	[mysqld]
	skip-grant-tables=1
mysql
mysql> update user set password=password('68882111') where user='root';
mysql> flush privileges;
注释掉skip-grant-tables=1
service mysql restart
#测试
mysql -uroot -p68882111

3. nginx配置

# vim /usr/local/nginx/conf/nginx.conf
user  www www;
worker_processes auto;
error_log  /home/wwwlogs/nginx_error.log  crit;
pid        /usr/local/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
events
    {
        use epoll;
        worker_connections 51200;
        multi_accept on;
    }
http
    {
        include       mime.types;
        default_type  application/octet-stream;

        server_names_hash_bucket_size 128;
        client_header_buffer_size 32k;
        large_client_header_buffers 4 32k;
        client_max_body_size 50m;
        sendfile   on;
        tcp_nopush on;
        keepalive_timeout 60;
        tcp_nodelay on;
        gzip on;
        gzip_min_length  1k;
        gzip_buffers     4 16k;
        gzip_http_version 1.1;
        gzip_comp_level 2;
        gzip_types     text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
        gzip_vary on;
        gzip_proxied   expired no-cache no-store private auth;
        gzip_disable   "MSIE [1-6]\.";
        server_tokens off;
        access_log off;
server {
    listen 80;
    server_name _;
    root /opt/jitamin/public;
    index index.php;
    charset utf-8;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    access_log off;
    error_log  /opt/jitamin.yourdomain.com-error.log error;
    sendfile off;
    client_max_body_size 100m;
    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/tmp/php-cgi.sock;
        #fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }
    location ~ /\.ht {
        deny all;
    }
}
include vhost/*.conf;
}

4. php-fpm配置

# vim /usr/local/php/etc/php.ini
date.timezone = "Asia/Shanghai"
cgi.fix_pathinfo=1
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server

##5. 重启lnmp # lnmp restart

6. 部署Jitamin代码

cd /opt
git clone https://github.com/jitamin/jitamin.git jitamincd 
cd jitamin

7. 设置配置文件

# cp .env.example .env
# vim .env
APP_NAME=Jitamin
APP_ENV=production
APP_DEBUG=true
APP_KEY=SomeRandomString
APP_TIMEZONE=Asia/Shanghai
APP_LOCALE=zh-CN
APP_THEME=black
APP_LOG=daily
APP_LOG_LEVEL=error
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=jitamin
DB_USERNAME=root
DB_PASSWORD=68882111

8. 安装依赖包

# composer install -o --no-dev

9. 安装数据库迁移和初始数据

  • 创建数据表

vendor/bin/phinx migrate

  • 安装初始数据

vendor/bin/phinx seed:run

10. 确保bootstrap/cache和storage目录可写

# chmod -R 0777 bootstrap/cache
# chmod -R 0777 storage
# php artisan config:cache
# php artisan route:cache

11.配置Web服务器

请将Web服务器的根目录指向 public/, 请参考 examples/ 下的相关配置文件,里面包含 Apache和Nginx的配置范例。

注意: examples/ 提供的仅仅是范例,并不能保证直接拷贝就能使用,需要根据实际情况进行相关配置调整。

12.浏览器访问

http://192.168.2.116:32801/

初始管理员的用户名和密码:

  • 用户名: admin or admin@admin.com
  • 密码: admin