openwrt uci 命令设置nginx
简介#
还是喜欢用nginx,比httpd功能全一些,openwrt也有nginx。简单安装即可。
但是它默认设置是uci.conf,且不可直接编辑,需要UCI命令来控制。
本文就介绍如何使用uci命令来设置openwrt 的 nginx。
官方说明:[OpenWrt Wiki] Nginx webserver
本文主要讨论更改openwrt中nginx的默认设置。
一:安装nginx#
opkg update && opkg install nginx-ssl
二:uci命令基础#
Usage: uci [<options>] <command> [<arguments>] Commands: batch export [<config>] import [<config>] changes [<config>] commit [<config>] add <config> <section-type> add_list <config>.<section>.<option>=<string> del_list <config>.<section>.<option>=<string> show [<config>[.<section>[.<option>]]] get <config>.<section>[.<option>] set <config>.<section>[.<option>]=<value> delete <config>[.<section>[[.<option>][=<id>]]] rename <config>.<section>[.<option>]=<name> revert <config>[.<section>[.<option>]] reorder <config>.<section>=<position> Options: -c <path> set the search path for config files (default: /etc/config) -d <str> set the delimiter for list values in uci show -f <file> use <file> as input instead of stdin -m when importing, merge data into an existing package -n name unnamed sections on export (default) -N don't name unnamed sections -p <path> add a search path for config change files -P <path> add a search path for config change files and use as default -t <path> set save path for config change files -q quiet mode (don't print error messages) -s force strict mode (stop on parser errors, default) -S disable strict mode -X do not use extended syntax on 'show'
三:检查配置show#
uci show nginx
四:增加监听端口add_list#
80 443都被封禁了,所以我将更改监听18080 18443端口,这两个端口必改。
五:提交配置重启nginx#
uci commit
/etc/init.d/nginx reload
service nginx restart
cat /etc/nginx/uci.conf
/etc/init.d/nginx reload
service nginx restart
这是两种openwrt 管理服务的方法,init.d 或 service。
六:其他配置#
这里是http部分的设置了。每次reload的时候,是从这个模板来生成的,改size,log_format,就在这里改了。
改玩reload restart,就可以了。
#
作者:上官飞鸿
出处:https://www.cnblogs.com/jackadam/p/18442647
版权:本作品采用「知识共享-署名-非商业性-禁止演绎(CC-BY-NC-ND)」许可协议进行许可。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
2018-10-01 sqlalchemy 获取表结构。