操作指引--All in box方案:電視盒子安裝ChatGPT、Jellyfin等服務(wù)并實(shí)現(xiàn)公網(wǎng)訪問
說明:凡以“#”開頭的命令為可選
#armbian-software? ?#software id:101
1.啟用Docker對IPv6的支持
docker network inspect bridge
ip -6 route show? ?#2409:8c00:de0:fad0::/64?
vim /etc/docker/daemon.json? #拷貝進(jìn)如下內(nèi)容
#########################################################################
{
? "ipv6": true,
? "fixed-cidr-v6": "2409:8c00:de0:fad0::/64", #用ip -6 route show獲取的IPv6前綴替換
}
#########################################################################
systemctl reload docker && systemctl restart docker
#docker network inspect bridge
2.拉取nginx鏡像并創(chuàng)建容器
docker pull nginx
docker run --name mynginx -p 10081:80 -d nginx
#curl 127.0.0.1:10081
3.配置mynginx容器、宿主機(jī)映射掛載配置文件和網(wǎng)頁文件
mkdir -p /home/dockers/nginx/{html,conf,log}
docker cp mynginx:/etc/nginx/nginx.conf /home/dockers/nginx/conf
docker cp mynginx:/usr/share/nginx/html /home/dockers/nginx
docker cp mynginx:/var/log/nginx /home/dockers/nginx/log
docker stop mynginx
docker rm -f mynginx
#vim /home/dockers/nginx/conf/default.conf
vim /home/dockers/nginx/conf/nginx.conf
#修改nginx.conf配置文件,
#########################################################################
user? nginx;
worker_processes auto;
events {
? ? worker_connections 512;
}
http {
? ? log_format '$remote_addr - $remote_user [$time_local] '
? ? ? ? ? ? ? ?'"$request" $status $body_bytes_sent '
? ? ? ? ? ? ? ?'"$http_referer" "$http_user_agent"';
? ? access_log /var/log/nginx/access.log;
? ? error_log /var/log/nginx/error.log;
? ? server {
? ? ? ? listen [::]:port1;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? location / {
? ? ? ? ? ? proxy_pass http://localhost:8096;
? ? ? ? }
? ? }
? ? server {
? ? ? ? listen [::]:port2;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? location / {
? ? ? ? ? ? proxy_pass http://localhost:10085;
? ? ? ? }
? ? }
? ? #include conf.d/default.conf
}
#########################################################################
docker run --name mynginx --net host \
? -v /home/dockers/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
? -v /home/dockers/nginx/conf/default.conf:/etc/nginx/conf.d/default.conf \
? -v /home/dockers/nginx/html:/usr/share/nginx/html \
? -v /home/dockers/nginx/log:/var/log/nginx -d nginx
5.驗(yàn)證與調(diào)優(yōu)
瀏覽器輸入example.com:3388訪問jelly服務(wù),example.com:3399訪問pandora服務(wù)。
(1)關(guān)注防火墻狀態(tài)和放行情況
(2)建議修改DNS服務(wù)器上的A記錄,由二級域名(如www)修改為@