Loading... Openwrt中的NGINX控制后台主要依靠`/etc/nginx/uci.conf`中的代码块来实现。关在在于每次重启后`uci.conf`始终重新生成,无法保留配置。 解决方法:修改`/etc/config/nginx`OP接口文件 Nginx源配置文件如下: ````` config main global option uci_enable 'true' config server '_lan' list listen '443 ssl default_server' list listen '[::]:443 ssl default_server' option server_name '_lan' list include 'restrict_locally' list include 'conf.d/*.locations' option uci_manage_ssl 'self-signed' option ssl_certificate '/etc/nginx/conf.d/_lan.crt' option ssl_certificate_key '/etc/nginx/conf.d/_lan.key' option ssl_session_cache 'shared:SSL:32k' option ssl_session_timeout '64m' option access_log 'off; # logd openwrt' config server '_redirect2ssl' list listen '80' list listen '[::]:80' option server_name '_redirect2ssl' option return '302 https://$host$request_uri' ````` 关闭自生成证书,注释掉 ``` option uci_manage_ssl 'self-signed' ```` 并填入替换自己的证书路径,示例如下: ``` config main global option uci_enable 'true' config server '_lan' list listen '443 ssl default_server' list listen '[::]:443 ssl default_server' option server_name '_lan' list include 'restrict_locally' list include 'conf.d/*.locations' #option uci_manage_ssl 'self-signed' option ssl_certificate '/mnt/data_sda1/Crt/op/op.crt' option ssl_certificate_key '/mnt/data_sda1/Crt/op/op.key' option ssl_session_cache 'shared:SSL:32k' option ssl_session_timeout '64m' option access_log 'off; # logd openwrt' config server '_redirect2ssl' list listen '80' list listen '[::]:80' option server_name '_redirect2ssl' option return '302 https://$host$request_uri' ``` 最后修改:2024 年 06 月 05 日 © 允许规范转载 赞 如果觉得我的文章对你有用,请随意赞赏