初始化EduSoho

下载源码

去官网下载

初始化程序

创建数据库:

mysql -uroot -e 'CREATE DATABASE `edusoho` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci'

创建程序配置文件,并修改数据库相关配置:

cd /var/www/edusoho
cp app/config/parameters.yml.dist app/config/parameters.yml

创建上传、缓存、日志目录:

mkdir -p app/cache app/logs app/data web/files
chmod 777 app/cache app/logs app/data web/files

初始化企培系统配置:

#初始超管用户名邮箱和密码可自行设置               用户名      邮箱         密码

app/console corporate-training:init-website admin admin@system.com admin

创建软连接:

php app/console assets:install web --symlink --relative

配置域名

添加域名解析:

ssudo bash -c 'echo "127.0.0.1 es.dev" >> /etc/hosts'

添加Nginx配置:

Ubuntu 用户在/etc/nginx/sites-enabled目录下,macOS 用户在/usr/local/etc/nginx/sites-enabled目录下,新增esdev.conf配置文件,内容如下:

server {
    set $root_dir /var/www/edusoho;
    set $webpack_server http://127.0.0.1:3030;

    server_name es.dev;
    root $root_dir/web;

    error_log /var/log/nginx/edusoho_error.log;
    access_log /var/log/nginx/edusoho_access.log;

    location / {
        try_files $uri /app_dev.php$is_args$args;
    }

    location ~ ^/(app_dev)\.php(/|$) {
        # fastcgi_pass unix:/run/php/php7.1-fpm.sock;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        fastcgi_param HTTP_X-Sendfile-Type X-Accel-Redirect;
        fastcgi_param HTTP_X-Accel-Mapping /udisk=$root_dir/app/data/udisk;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 8 128k;
    }

    location ~ ^/static-dist {
        proxy_pass $webpack_server;
    }

    location ~ ^/udisk {
        root $root_dir/app/data/;
        internal;
    }

    location ~ \.php$ {
      return 404;
    }
}

注意

此Nginx配置只能用于开发环境,正式生产环境配置,请参考:EduSoho部署

重启Nginx:

Ubuntu:

sudo service nginx restart

macOS:

sudo brew services restart nginx

前端实时编译

安装依赖包:

cd /var/www/edusoho
yarn

启动实时编译服务:

npm run dev

验证配置

在浏览器中打开 http://es.dev ,如出现EduSoho首页,表示配置成功。系统默认超管账号为:

用户名:测试管理员
密码:kaifazhe

results matching ""

    No results matching ""