ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/net/nginx/files-luci-support/60_nginx-luci-support b/external/subpack/net/nginx/files-luci-support/60_nginx-luci-support
new file mode 100644
index 0000000..b256444
--- /dev/null
+++ b/external/subpack/net/nginx/files-luci-support/60_nginx-luci-support
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+if nginx -V 2>&1 | grep -q ubus; then
+ if [ -z "$(cat /etc/nginx/conf.d/luci.locations | grep ubus)" ]; then
+ cat <<EOT >> /etc/nginx/conf.d/luci.locations
+
+location /ubus {
+ ubus_interpreter;
+ ubus_socket_path /var/run/ubus/ubus.sock;
+ ubus_parallel_req 2;
+}
+EOT
+ fi
+fi
+
+grep -q /var/run/ubus.sock /etc/nginx/conf.d/luci.locations &&
+ sed -i 's#/var/run/ubus.sock#/var/run/ubus/ubus.sock#' /etc/nginx/conf.d/luci.locations
+
+if [ -x /etc/init.d/uhttpd ]; then
+ /etc/init.d/uhttpd disable
+ if [ -n "$(pgrep uhttpd)" ]; then
+ /etc/init.d/uhttpd stop
+ fi
+fi
+
+/etc/init.d/nginx enable
+if [ -n "$(pgrep nginx)" ]; then
+ /etc/init.d/nginx restart
+else
+ /etc/init.d/nginx start
+fi
+
+/etc/init.d/uwsgi enable
+if [ -n "$(pgrep uwsgi)" ]; then
+ /etc/init.d/uwsgi restart
+else
+ /etc/init.d/uwsgi start
+fi
+
+
+exit 0
diff --git a/external/subpack/net/nginx/files-luci-support/luci.locations b/external/subpack/net/nginx/files-luci-support/luci.locations
new file mode 100644
index 0000000..374ee5d
--- /dev/null
+++ b/external/subpack/net/nginx/files-luci-support/luci.locations
@@ -0,0 +1,17 @@
+location /cgi-bin/luci {
+ index index.html;
+ include uwsgi_params;
+ 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) {
+ include uwsgi_params;
+ uwsgi_param SERVER_ADDR $server_addr;
+ uwsgi_modifier1 9;
+ uwsgi_pass unix:////var/run/luci-cgi_io.socket;
+}
+
+location /luci-static {
+ error_log stderr crit;
+}