Nginx-Proxy-Manager修复笔记

排查Nginx Proxy Manager,反向代理,让网站变成HTTPS

有什么用

排查Nginx Proxy Manager,反向代理,让网站变成HTTPS

实现方法

Nginx Proxy Manager 登录异常
http://192.168.6.116:881/login

11am NPM, 登录失败错误:Bad Gateway
	template-db-1	已停止	jc21/mariadb-aria:latest	
发现是附属的docker的"/template-db-1" 启动失败
- 修复?

2023-11-03  3:13:28 0 [Note] /usr/bin/mysqld (mysqld 10.4.15-MariaDB) starting as process 1 ...
2023-11-03  3:13:28 0 [ERROR] mysqld: Can't create/write to file '/var/lib/mysql/aria_log_control' (Errcode: 13 "Permission denied")
2023-11-03  3:13:28 0 [ERROR] mysqld: Got error 'Can't create file' when trying to use aria control file '/var/lib/mysql/aria_log_control'
2023-11-03  3:13:28 0 [ERROR] Plugin 'Aria' init function returned error.
2023-11-03  3:13:28 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2023-11-03  3:13:28 0 [Note] Plugin 'InnoDB' is disabled.
2023-11-03  3:13:28 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-11-03  3:13:28 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2023-11-03  3:13:28 0 [ERROR] Failed to initialize plugins.
2023-11-03  3:13:28 0 [ERROR] Aborting

可能是从因为Nginx Proxy Manager是通过docker-compose来运行的,断电重启以后,docker无法自动正确地按docker-compose来启动了。
解决办法是
1. 关闭这个两个docker容器(jc21/nginx-proxy-manager:latest	和 jc21/mariadb-aria:latest)
2. SSH去执行
	# cd /www/server/panel/data/compose/NginxPorxyManager/template
	# docker-compose up -d
这就意味着以后,以后机器重启,都要去手动去执行这docker-compose,有没有更好的解决办法?
解决了docker启动,登录NPM还是提示:Bad Gateway错误
检查了docker ps,依旧Restarting (1) 28 seconds ago  template-db-1

2:20pm
Docker 具体错误
template-db-1 | 2023-11-03 6:20:19 0 [ERROR] Plugin 'Aria' init function returned error. template-db-1 | 2023-11-03 6:20:19 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed. template-db-1 | 2023-11-03 6:20:19 0 [Note] Plugin 'InnoDB' is disabled. template-db-1 | 2023-11-03 6:20:19 0 [Note] Plugin 'FEEDBACK' is disabled. template-db-1 | 2023-11-03 6:20:19 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded template-db-1 | 2023-11-03 6:20:19 0 [ERROR] Failed to initialize plugins. template-db-1 | 2023-11-03 6:20:19 0 [ERROR] Aborting
最后方案:放弃视频‘推荐’的方案,改用默认的sqlite.

4:46pm NPM
改了配置以后,服务都正常了;可是新的配置在UI上没有加载之前的的配置内容。
不配置maradb db section, NPM会自己在保存在./data目录下面一个database.sqlite文件数据库。
5:10pm Cloudflare API token 重新配置
dns_cloudflare_api_token e385e19ce47c207b15bf@@@@@
重新申请证书,用DNS challenge的方式。 

接下来,新的反代的就直接去新建就好了(待验证)
》5:17pm

如何编辑artalk的robots.txt

收到Google的邮件(New reason preventing your pages from being indexed)
第二天根据链接里面的indexing report,转到问题的问题;之前还去主站点位置添加的www.carlzeng.top/robots.txt.
原来是报告https://artalk.carlzeng.top:4443/robots.txt 这个页面下的。

在artalk容器以及映射出来的目录找了半天也找不到这个文件,莫非是程序动态生成的(无解了?)
也可能是NPM的反代有这样的设置?
https://www.iots.vip/post/hexo-artalk-comment.html

在BT中,/www/server/phpmyadmin/phpmyadmin_c123@@/目录下,搜索到了robots.txt, 修改内容为:
User-agent: *
Allow: /
继续访问https://artalk.carlzeng.top:4443/robots.txt;仍然无效
尝试修改NPM中关于artalk反代的nginx配置文件,参考博客样式
location =/robots.txt {
default_type text/html;
add_header Content-Type "text/plain; charset=UTF-8";
return 200 "User-Agent: \nAllow: /";
}

12:56pm NPM配置好的一个个host,被保存在了debian映射出来的那个目录?
原来都保存在了 docker-compose.yml 的目录下,
/www/server/panel/data/compose/NginxPorxyManager/template/data/nginx/proxy_host#

  1. 修改配置nginx问题 root@Debian11:/www/server/panel/data/compose/NginxPorxyManager/template/data/nginx/proxy_host# vi 1.conf

  2. 重启NPM docker-compose
    root@Debian11:/www/server/panel/data/compose/NginxPorxyManager/template# docker-compose restart

  3. 验证 https://artalk.carlzeng.top:4443/robots.txt
    User-agent: *
    Allow:/

    Works perfect

灵感来源:
如果需要 Nginx 反向代理, 这里提供一份 Nginx 配置参考
https://zh.wikipedia.org/zh-tw/Robots.txt

Debian 11的一些基础

Debian 11默认是关闭ssh的,如何开启?设置了自动开启,断电重启就无忧
	旧方案是:在BT面板中开启SSH开关,然后用carl用户登录进ssh,在su,就可以到root用户下
	新的:
		算了,为了debian11安全,就不开放ssh了;走面板,或者pve终端的ssh


artalk docker 没有自动重启,如何设置特定的docker自动重启?假设机器死机需要断电重启
	手动重启成功
posted @ 2023-11-12 09:28  CarlZeng  阅读(627)  评论(0编辑  收藏  举报