安装向导 - Ubuntu 14.04
Step1:安装PHP7.1
1.ubuntu 14.04, 添加PHP 7的APT源
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php-pear php7.1-cli php7.1-common php7.1-curl php7.1-dev php7.1-fpm php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-opcache php7.1-zip php7.1-intl php7.1-gd php7.1-xml php7.1-ldap
- 修改PHP-FPM监听方式
sudo sed -i ‘s/listen = .*/listen = 127.0.0.1:9000/g’ /etc/php/7.1/fpm/pool.d/www.conf
- *修改PHP上传文件的大小限制(若使用云视频则不需要修改)
sudo vi /etc/php/7.1/fpm/php.ini
修改以下三项配置为:
post_max_size = 1024M
memory_limit = 1024M
upload_max_filesize = 1024M
- 重启PHP-FPM服务进程
sudo service php7.1-fpm restart
Step2:安装MySQL
1.安装mysql,过程中会要求您输入MySQL数据库的root密码
sudo apt-get update
sudo apt-get install mysql-server
Step3:安装Nginx
1.安装
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update
sudo apt-get install nginx
2.*修改Nginx上传限制(若使用云视频则不需要修改)
sudo vi /etc/nginx/nginx.conf
然后 在http{} 字段里添加
client_max_body_size 1024M;
Step4: 配置安装EduSoho企培版
- 解压安装包
sudo mkdir /var/www
cd /var/www
sudo tar zxvf edusoho-{VERSION}.tar.gz #替换对应版本
- 创建空数据库
mysql -uroot -p
输入您安装mysql时设置的密码,进入数据库命令行模式后,执行:
CREATE DATABASE edusoho
DEFAULT CHARACTER SET utf8;
3.为edusoho企培版创建mysql用户
#{username}和{password}替换为需要创建的用户名和密码
GRANT ALL PRIVILEGES ON edusoho
.* TO ‘{username}’@‘localhost’ IDENTIFIED BY ‘{password}’;
#测试用户是否创建成功
mysql -u{username} -p --default-character-set=utf8 edusoho
- 配置nginx的虚拟主机
sudo vi /etc/nginx/sites-enabled/edusoho
输入以下内容:(配置文件中的example.com 替换成您需要指定的域名)
server {
set $root_dir /var/www/edusoho;
# 改成您的网站域名
server_name www.example.com;
root $root_dir/web;
error_log /var/log/nginx/edusoho.error.log;
access_log /var/log/nginx/edusoho.access.log;
location / {
index app.php;
try_files $uri @rewriteapp;
}
location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}
location ~ ^/(app|app_dev)\.php(/|$) {
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;
internal;
}
location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
expires 3y;
access_log off;
gzip off;
}
location ~* \.(css|js)$ {
expires 3y;
access_log off;
}
location ~ ^/udisk {
root $root_dir/app/data/;
internal;
}
# 以下配置允许运行.php的程序,方便于其他第三方系统的集成。
location ~ \.php$ {
# [改] 请根据实际php-fpm运行的方式修改
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS off;
fastcgi_param HTTP_PROXY "";
}
}
5.重启nginx
sudo service nginx restart
- 修改目录权限:
sudo chown -Rf www-data:www-data /var/www/edusoho
- 测试访问网站
浏览器中打开:http://YOU_DOMAIN. 如果看到系统配置页面那么恭喜你安装成功了。
*YOU_DOMAIN是您刚刚在nginx配置的域名,如果是是测试域名还需要在您本地hosts里添加映射