安装 nginx-ui

nginx-ui:

1
wget https://github.com/0xJacky/nginx-ui/releases/download/v2.0.0-rc.5/nginx-ui-linux-64.tar.gz

app.ini

1
2
[server]
Port = 14396

nginx-ui supervisor 后台

1
2
3
4
5
6
7
8
9
[program:nginx-ui]
user=root
command=/root/nginx-ui/nginx-ui -config /root/nginx-ui/app.ini
autorestart=true
startsecs=10
redirect_stderr=true
logfile_maxbytes=50MB
stdout_logfile=/export/Logs/supervisor/nginx-ui.log
logfile_backups=2

安装 nginx

然后 nginx

1
apt install nginx

添加 nginx 的后台
supervisor conf

1
2
3
4
5
6
7
8
9
[program:nginx]
user=root
command=/usr/sbin/nginx -g 'daemon off;'
autorestart=true
startsecs=10
redirect_stderr=true
logfile_maxbytes=50MB
stdout_logfile=/export/Logs/supervisor/nginx.log
logfile_backups=2

nginx 反代

由于 80 端口冲突, 需要反代一下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
server {
listen 80 ;
server_name ui.mytest.jd.com;
index index.php index.html index.htm default.php default.htm default.html;
access_log /www/sites/ui.mytest.jd.com/log/access.log;
error_log /www/sites/ui.mytest.jd.com/log/error.log;
location ^~ / {
proxy_pass http://127.0.0.1:14396;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
add_header X-Cache $upstream_cache_status;
add_header Cache-Control no-cache;
proxy_ssl_server_name off;
proxy_ssl_name $proxy_host;
}
}

杂项

  1. 改密码如果报错 error:Module is unknown
    1
    2
    # refer https://www.oryoy.com/news/ubuntu-xi-tong-mi-ma-nan-ti-jie-mi-passwd-mo-kuai-wei-zhi-cuo-wu-quan-jie-xi.html
    apt-get install libpam-cracklib

安装 1p

直接下载离线包, 然后启动. 安装会失败, 因为没有 systemd, 改为 supervisor 即可

1p conf

1
2
3
4
5
6
7
8
9
10
11
12
[program:1p]
user=root
command=1panel
autostart=true
autorestart=true
startsecs=10
startretries=3 ; 设置最大重启次数
redirect_stderr=true
stdout_logfile=/var/log/1p.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=2
environment=HTTP_PROXY="http://127.0.0.1:7888/",HTTPS_PROXY="http://127.0.0.1:7888/",NO_PROXY="localhost,127.0.0.1",http_proxy="http://127.0.0.1:7888/",https_proxy="http://127.0.0.1:7888/",

docker conf

1
2
3
4
5
6
7
8
9
10
11
12
[program:docker]
user=root
command=dockerd
autostart=true
autorestart=true
startsecs=10
startretries=3 ; 设置最大重启次数
redirect_stderr=true
stdout_logfile=/var/log/docker.log
stdout_logfile_maxbytes=50MB
stdout_logfile_backups=2
environment=HTTP_PROXY="http://127.0.0.1:7888/",HTTPS_PROXY="http://127.0.0.1:7888/",NO_PROXY="localhost,127.0.0.1"

安装离线包

1
2
3
4
scp -r -P 443 1panel-v1.10.29-lts-linux-amd64.tar.gz root@ip
tar -zxvf 1panel*
cd 1pan*
bash install.sh

此时 docker 缺 iptables

1
apt-get install iptables

然后 supervisor 就可启动了

appstore

  1. 从线上/git拷贝完整的apps到/opt/1panel/resource/apps/local目录
  2. 重启获得新的db, 然后修改db
    1
    2
    3
    UPDATE apps SET key = SUBSTR(key, 6) WHERE key LIKE 'local%';

    UPDATE apps SET resource = 'remote' WHERE resource = 'local';
  3. 把apps挪到remote, 重启就可以了

ref
https://mayx.eu.org/2024/02/03/1panel#%E7%A6%BB%E7%BA%BF%E5%AE%89%E8%A3%851panel%E4%B8%AD%E5%BA%94%E7%94%A8%E7%9A%84%E6%96%B9%E6%B3%95
https://github.com/1Panel-dev/appstore