Appearance
初始化EduSoho企培系统
下载源码
初始化程序
创建数据库:
bash
mysql -uroot -e 'CREATE DATABASE `edusoho` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci'
创建程序配置文件,并修改数据库相关配置:
bash
cd /var/www/edusoho
cp app/config/parameters.yml.dist app/config/parameters.yml
创建上传、缓存、日志目录:
bash
mkdir -p app/cache app/logs app/data web/files
chmod 777 app/cache app/logs app/data web/files
初始化企培系统配置:
bash
# 初始超管用户名邮箱和密码可自行设置 用户名 邮箱 密码
app/console corporate-training:init-website admin admin@system.com admin123 --dev
创建软连接:
bash
php app/console assets:install web --symlink --relative
配置域名
添加域名解析:
bash
sudo 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
配置文件,内容如下:
nginx
server {
set $root_dir /var/www/edusoho;
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|app)\.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 http://127.0.0.1:3030;
}
# 新版静态资源实时编译代理,不需要实时编译可以注释掉
location ~ ^/static-dist(/.+?plugin)?/vue3 {
proxy_pass http://127.0.0.1:3002;
}
location ~ ^/udisk {
root $root_dir/app/data/;
internal;
}
location ~ \.php$ {
return 404;
}
}
重启Nginx:
Ubuntu:
bash
sudo service nginx restart
macOS:
bash
sudo brew services restart nginx
前端编译
Node 版本
16.20.2
安装依赖包:
bash
cd /var/www/edusoho
npm install
启动实时编译服务:
bash
# 相当于 npm run serve && cd vue3 && npm run serve
npm run dev
编译发布:
bash
# 相当于 npm run build && cd vue3 && npm run build
npm run compile
验证配置
在浏览器中打开 http://es.dev ,如出现EduSoho首页,表示配置成功。系统默认超管账号为:
bash
用户名:admin
密码:admin123