部署edosoho企培系统

安装环境:ubuntu2204 + mysql:8.0.36 + php:7.3 + nginx:1.18 + edusoho:23.4.4

ubuntu环境初始化

1
2
3
4
5
6
# 更新软件信息
root@ubuntu2204:~# apt-get update
# 更新已安装的软件包
root@ubuntu2204:~# apt-get upgrade
# 安装基础软件
root@ubuntu2204:~# apt-get install -y wget zip gcc make perl vim libmcrypt-dev mcrypt

安装配置nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# apt安装nginx
root@ubuntu2204:~# apt-get install -y nginx

# 在http块中添加“client_max_body_size 1024M;”
root@ubuntu2204:~# vim /etc/nginx/nginx.conf

http {

##
# Basic Settings
##

client_max_body_size 1024M;

sendfile on;
tcp_nopush on;

root@ubuntu2204:~# systemctl restart nginx

安装配置mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# apt安装mysql8.0
root@ubuntu2204:~# apt list mysql-server
Listing... Done
mysql-server/jammy-updates,jammy-security 8.0.36-0ubuntu0.22.04.1 all
N: There is 1 additional version. Please use the '-a' switch to see it

root@ubuntu2204:~# apt install -y mysql-server

# 更改密码
root@ubuntu2204:~# mysql
mysql> SHOW VARIABLES LIKE 'validate_password%';
Empty set (0.04 sec)

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'qwer@1234';
Query OK, 0 rows affected (0.15 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.08 sec)

root@ubuntu2204:~# systemctl restart mysql

安装配置PHP环境

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@ubuntu2204:~# apt-get install -y language-pack-en-base
root@ubuntu2204:~# apt-get install -y software-properties-common
root@ubuntu2204:~# LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
root@ubuntu2204:~# apt-get update

root@ubuntu2204:~# apt-get -y install php7.3-fpm php7.3-mysql php7.3-curl php7.3-gd php7.3-mbstring php7.3-xml php7.3-xmlrpc php7.3-zip php7.3-opcache php7.3-redis php7.3-memcache

# 修改php环境
root@ubuntu2204:~# vim /etc/php/7.3/fpm/php.ini
post_max_size = 1024M
memory_limit = 1024M
upload_max_filesize = 1024M

# 修改php监听
root@ubuntu2204:~# vim /etc/php/7.3/fpm/pool.d/www.conf
;listen = /run/php/php7.3-fpm.sock
listen = 127.0.0.1:9000

root@ubuntu2204:~# service php7.3-fpm restart

下载并初始化edusoho

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@ubuntu2204:~# cd /var/www/
root@ubuntu2204:/var/www# wget https://edusoho-static.edusoho.com/install/edusoho-ct-23.4.4.zip
root@ubuntu2204:/var/www# unzip edusoho-ct-23.4.4.zip
root@ubuntu2204:/var/www# chown -R www-data:www-data ./edusoho
root@ubuntu2204:/var/www# chmod -R 777 ./edusoho

root@ubuntu2204:/var/www# ll ./edusoho/
total 44
drwxrwxrwx 10 www-data www-data 4096 Dec 25 07:17 ./
drwxr-xr-x 4 root root 4096 May 29 04:49 ../
-rwxrwxrwx 1 www-data www-data 1320 Dec 25 07:17 README.txt*
drwxrwxrwx 5 www-data www-data 4096 Dec 25 07:17 api/
drwxrwxrwx 8 www-data www-data 4096 Dec 25 07:17 app/
drwxrwxrwx 2 www-data www-data 4096 Dec 25 07:17 bootstrap/
drwxrwxrwx 2 www-data www-data 4096 Dec 25 07:17 plugins/
drwxrwxrwx 10 www-data www-data 4096 Dec 25 07:17 src/
drwxrwxrwx 54 www-data www-data 4096 Dec 25 07:17 vendor/
drwxrwxrwx 3 www-data www-data 4096 Dec 25 07:17 vendor_user/
drwxrwxrwx 9 www-data www-data 4096 Dec 25 07:17 web/

配置edusoho站点nginx配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
root@ubuntu2204:/var/www# vim /etc/nginx/sites-enabled/edusoho
server {
listen 80;
server_name edu.xcjyc.top; #改成自己的业务域名
root /var/www/edusoho/web;
access_log /var/log/nginx/edusoho.com.access.log ;
error_log /var/log/nginx/edusoho.com.error.log;

location / {
index app.php;
try_files $uri @rewriteapp;
}

location @rewriteapp {
rewrite ^(.*)$ /app.php/$1 last;
}

location ~ ^/udisk {
internal;
root /var/www/edusoho/app/data/;
}

location ~ ^/(app|app_dev)\.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 HTTP_X-Sendfile-Type X-Accel-Redirect;
fastcgi_param HTTP_X-Accel-Mapping /udisk=/var/www/edusoho/app/data/udisk;
fastcgi_param TRACE_ID $request_id;
fastcgi_buffer_size 128k;
fastcgi_buffers 8 128k;
}

# 以下配置允许运行.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 HTTP_PROXY "";
}

location ~* \.(jpg|jpeg|gif|png|ico|swf)$ {
expires 3y;
access_log off;
gzip off;
}

location ~* \.(css|js)$ {
access_log off;
expires 3y;
}

location ~* \.(eot|svg|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
expires 3y;
access_log off;
gzip off;
}

location ~ ^/files/.*\.(php|php5)$ {
deny all;
}
}

# 重启nginx
root@ubuntu2204:~# systemctl restart nginx

打开浏览器初始化edusoho

初始化安装完成后可执行升级程序,升级edusoho版本。

edusohoupdate


部署edosoho企培系统
https://www.xcjyc.top/2024/05/29/部署edosoho企培系统/
作者
XCJYC
发布于
2024年5月29日
许可协议