1.安装 docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-utils:yum 管理工具包
device-mapper-persistent-data:设备映射包
lvm2:lvm 包
yum-config-manager
--add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce.x86_64 --showduplicates | sort -r
yum -y install docker
创建加速器
mkdir -p /etc/docker
tee
/etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["[https://dzwue2eq.mirror.aliyuncs.com](https://dzwue2eq.mirror.aliyuncs.com)"]
}
EOF
2.启动 docker
systemctl start docker
systemctl enable docker
3.下载 Solo 镜像
docker pull b3log/solo
4.安装 mysql
yum -y install mariadb mariadb-server mariadb-libs
systemctl start mariadb
systemctl enable mariadb
mysql #命令行输入,设置密码
创建数据库
create database solo default character set utf8mb4 collate utf8mb4_general_ci;
授权
grant all privileges on . to 'root'@'127.0.0.1';
flush privileges;
5.启动镜像
docker run --detach --name solo --network=host
--env RUNTIME_DB="MYSQL"
--env JDBC_USERNAME="root"
--env JDBC_PASSWORD="XXXXXX"
--env JDBC_DRIVER="com.mysql.cj.jdbc.Driver"
--env JDBC_URL="jdbc:
b3log/solo --listen_port=8080 --server_scheme=https --server_host=填写自己的域名 --server_port= --lute_http=http://localhost:8249
6.下载 nginx
sudo yum install yum-utils
vim /etc/yum.repos.d/nginx.repo
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
yum-config-manager --enable nginx-mainline
yum install nginx
systemctl start nginx
systemctl enable nginx
7.配置代理
upstream backend {
server localhost:8080; # Solo 监听端口
}
server {
listen 80;
access_log off;
#填写证书绑定的域名
server_name xxxxx;
#将所有 HTTP 请求通过 rewrite 指令重定向到 HTTPS。
rewrite ^(.*) https://host$1;
location / {
index index.html index.htm;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name xxx;
root /usr/share/nginx/html;
ssl_certificate "ssl/xxx_crt";
ssl_certificate_key "ssl/xxx_.key";
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://backend$request_uri;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
client_max_body_size 10m;
}
}
8.访问 Solo
https://你的域名:443
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于