openwrt-nginx取消强制https

Linux
1910 0

luci-nginx 默认启用https强制跳转,假如你没有配置好ssl证书,
chrome之类的浏览器会直接拦截,需要手动点击才可以跳转到后台页面。
作为路由后台,也没有必要去申请ssl证书。

解决方法:

vim /etc/config/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'

直接删去ssl相关配置,由80端口访问_lan

config main global
    option uci_enable 'true'
 
config server '_lan'
    list listen '80 default_server'
    list listen '[::]:80 default_server'
    option server_name '_lan'
    #list include 'restrict_locally'
    list include 'conf.d/*.locations'

:wq保存

#重载nginx配置
service nginx reload

这时访问http后台地址就不会被拦截了,
ttyd终端页面也可以正常显示。

op-3.PNG

最后更新 2022-11-26
评论 ( 0 )
OωO
隐私评论