small-package/diy/patches/nginx_luci.patch

57 lines
2.0 KiB
Diff

--- a/nginx/files-luci-support/luci.locations
+++ b/nginx/files-luci-support/luci.locations
@@ -1,11 +1,12 @@
-location /cgi-bin/luci {
+location /luci {
index index.html;
include uwsgi_params;
+ uwsgi_read_timeout 300s;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_modifier1 9;
uwsgi_pass unix:////var/run/luci-webui.socket;
}
-location ~ /cgi-bin/cgi-(backup|download|upload|exec) {
+location ~ /cgi-(backup|download|upload|exec) {
include uwsgi_params;
uwsgi_param SERVER_ADDR $server_addr;
uwsgi_modifier1 9;
--- a/dnsmasq/files/dnsmasq.init
+++ b/dnsmasq/files/dnsmasq.init
@@ -403,6 +403,21 @@ dhcp_this_host_add() {
local routerstub routername ifdashname
local lanaddr lanaddr6 lanaddrs6 ulaprefix
+network_get_ipaddr lanaddr "lan"
+if [ -n $lanaddr ]; then
+ lanaddr="$(echo "$lanaddr" | sed -e "s/\/24//")"
+ echo "
+$lanaddr op" >/tmp/hosts/shortcuts
+if [ -f /etc/nginx/conf.d/shortcuts.conf ]; then
+if [[ "$lanaddr" != "`grep "set \$ip" /etc/nginx/conf.d/shortcuts.conf | head -n1 | cut -f 3 -d " " | sed -e 's/;//'`" ]]; then
+ sed -i "/set \$ip/c\set \$ip $lanaddr;" /etc/nginx/conf.d/shortcuts.conf
+ /etc/init.d/nginx reload
+fi
+cat /etc/nginx/conf.d/shortcuts.conf | tr "\n" "\r" |grep -oE 'server_name [a-z.-]*;[^;]*set \$ip [0-9.]*;' | sed -e 's/server_name \(.*\);.*location.*set $ip \(.*\);/\2 \1/' >>/tmp/hosts/shortcuts
+cat /etc/nginx/conf.d/shortcuts.conf | tr "\n" "\r" |grep -oE 'server_name [a-z.-]*;[^;]*return 301 \$scheme://op' | sed -e 's/server_name \(.*\?\);.*/\1/' | sed -e "s/^/$lanaddr /">>/tmp/hosts/shortcuts
+fi
+fi
+
if [ "$mode" -gt 0 ] ; then
ifdashname="${ifname//./-}"
routerstub="$( md5sum /etc/os-release )"
--- a/nginx/files/nginx.init
+++ b/nginx/files/nginx.init
@@ -23,6 +23,10 @@ nginx_init() {
rm -f "$(readlink "${UCI_CONF}")"
${NGINX_UTIL} init_lan
+ if [ ! -h "${UCI_CONF}" ]
+ then ln -sf /var/lib/nginx/uci.conf ${UCI_CONF}
+ fi
+
if [ -e "${UCI_CONF}" ]
then CONF="${UCI_CONF}"
else CONF="${NGINX_CONF}"