Pārlūkot izejas kodu

web: refactor nginx configuration

Saúl Ibarra Corretgé 6 gadi atpakaļ
vecāks
revīzija
5c988de8b6

+ 6 - 35
web/rootfs/defaults/default

@@ -1,41 +1,12 @@
 server {
 	listen 80 default_server;
-	listen 443 ssl;
-
-	server_name _;
-
-	include /config/nginx/ssl.conf;
-
-	client_max_body_size 0;
-
-	root /usr/share/jitsi-meet;
-	index index.html
-	error_page 404 /static/404.html;
-
-	location ~ ^/([a-zA-Z0-9=\?]+)$ {
-		rewrite ^/(.*)$ / break;
-	}
 
-   	location /config.js {
-        alias /config/config.js;
-	}
-
-   	location /interface_config.js {
-        alias /config/interface_config.js;
-	}
-
-   	location /external_api.js {
-        alias /usr/share/jitsi-meet/libs/external_api.min.js;
-	}
+	include /config/nginx/meet.conf;
+}
 
-    location / {
-        ssi on;
-    }
+server {
+	listen 443 ssl;
 
-	# BOSH
-	location /http-bind {
-		proxy_pass {{ .Env.XMPP_BOSH_URL_BASE }}/http-bind;
-		proxy_set_header X-Forwarded-For $remote_addr;
-		proxy_set_header Host {{ .Env.XMPP_DOMAIN }};
-	}
+	include /config/nginx/ssl.conf;
+	include /config/nginx/meet.conf;
 }

+ 34 - 0
web/rootfs/defaults/meet.conf

@@ -0,0 +1,34 @@
+server_name _;
+
+client_max_body_size 0;
+
+root /usr/share/jitsi-meet;
+index index.html
+error_page 404 /static/404.html;
+
+location ~ ^/([a-zA-Z0-9=\?]+)$ {
+    rewrite ^/(.*)$ / break;
+}
+
+location /config.js {
+    alias /config/config.js;
+}
+
+location /interface_config.js {
+    alias /config/interface_config.js;
+}
+
+location /external_api.js {
+    alias /usr/share/jitsi-meet/libs/external_api.min.js;
+}
+
+location / {
+    ssi on;
+}
+
+# BOSH
+location /http-bind {
+    proxy_pass {{ .Env.XMPP_BOSH_URL_BASE }}/http-bind;
+    proxy_set_header X-Forwarded-For $remote_addr;
+    proxy_set_header Host {{ .Env.XMPP_DOMAIN }};
+}

+ 5 - 1
web/rootfs/etc/cont-init.d/10-config

@@ -35,6 +35,10 @@ if [[ ! -f /config/nginx/nginx.conf ]]; then
     cp /defaults/nginx.conf /config/nginx/nginx.conf
 fi
 
+if [[ ! -f /config/nginx/meet.conf ]]; then
+    tpl /defaults/meet.conf > /config/nginx/meet.conf
+fi
+
 if [[ ! -f /config/nginx/ssl.conf ]]; then
     tpl /defaults/ssl.conf > /config/nginx/ssl.conf
 fi
@@ -44,7 +48,7 @@ if [ ! -f "/config/nginx/dhparams.pem" ]; then
 fi
 
 if [[ ! -f /config/nginx/site-confs/default ]]; then
-    tpl /defaults/default > /config/nginx/site-confs/default
+    cp /defaults/default /config/nginx/site-confs/default
 fi
 
 if [[ ! -f /config/config.js ]]; then