diff --git a/docker-host/setup/files/default.lablad b/docker-host/setup/files/default.lablad new file mode 100644 index 0000000..343cd31 --- /dev/null +++ b/docker-host/setup/files/default.lablad @@ -0,0 +1,8 @@ +# This config is purely for the default landing page that nginx normally serves +# up. The intention is to make Nginx's default page useful + +server { + listen 80 default_server; + listen [::]:80 default_server; + root /var/www/html; +} \ No newline at end of file diff --git a/docker-host/setup/files/files.lablad b/docker-host/setup/files/files.lablad index c2aa632..a527184 100644 --- a/docker-host/setup/files/files.lablad +++ b/docker-host/setup/files/files.lablad @@ -1,5 +1,5 @@ server { - server_name files.lablad; + server_name files.lablad.net; location / { proxy_pass http://127.0.0.1:8080; } diff --git a/docker-host/setup/files/git.lablad b/docker-host/setup/files/git.lablad index 46b4164..3324c92 100644 --- a/docker-host/setup/files/git.lablad +++ b/docker-host/setup/files/git.lablad @@ -3,7 +3,7 @@ # The default port is listed under /vars/main.yml as 3000 as GITEA_PUB_PORT server { - server_name git.lablad; + server_name git.lablad.net; location / { proxy_pass http://127.0.0.1:3000; } diff --git a/docker-host/setup/files/home.lablad b/docker-host/setup/files/home.lablad new file mode 100644 index 0000000..7be8c88 --- /dev/null +++ b/docker-host/setup/files/home.lablad @@ -0,0 +1,8 @@ +server { + root /var/www/html; + index index.html; + server_name lablad.net; + location / { + try_files $uri $uri/ =404; + } +} \ No newline at end of file diff --git a/docker-host/setup/files/metrics.lablad b/docker-host/setup/files/metrics.lablad index d920446..6cd628c 100644 --- a/docker-host/setup/files/metrics.lablad +++ b/docker-host/setup/files/metrics.lablad @@ -1,7 +1,7 @@ # metrics.lablad server { - server_name metrics.lablad; + server_name metrics.lablad.net; proxy_set_header Host $http_host; location / { proxy_pass http://127.0.0.1:6000; diff --git a/docker-host/setup/files/music.lablad b/docker-host/setup/files/music.lablad index 72793f7..77f8c2c 100644 --- a/docker-host/setup/files/music.lablad +++ b/docker-host/setup/files/music.lablad @@ -1,5 +1,5 @@ server { - server_name music.lablad; + server_name music.lablad.net; location / { proxy_pass http://127.0.0.1:4040; } diff --git a/docker-host/setup/files/todo.lablad b/docker-host/setup/files/todo.lablad new file mode 100644 index 0000000..6044561 --- /dev/null +++ b/docker-host/setup/files/todo.lablad @@ -0,0 +1,8 @@ +server { + server_name todo.lablad.net; + location / { + proxy_pass http://127.0.0.1:9238; + } +} + + diff --git a/docker-host/setup/tasks/nginx.yml b/docker-host/setup/tasks/nginx.yml index dbde61c..99e0bb7 100644 --- a/docker-host/setup/tasks/nginx.yml +++ b/docker-host/setup/tasks/nginx.yml @@ -21,6 +21,11 @@ name: apache2 state: absent + - name: Ensure the default website is disabled + file: + path: /etc/nginx/sites-enabled/default + state: absent + - name: website user account user: name: "{{STATIC_USER}}" @@ -44,8 +49,8 @@ - ../files/music.lablad - ../files/files.lablad - ../files/metrics.lablad - - ../files/metrics.lablad - ../files/todo.lablad + - ../files/home.lablad - name: Enable Sites file: @@ -58,6 +63,7 @@ - files.lablad - metrics.lablad - todo.lablad + - home.lablad notify: - restart-nginx diff --git a/docker-host/setup/templates/proxy.conf.j2 b/docker-host/setup/templates/proxy.conf.j2 new file mode 100644 index 0000000..5daae77 --- /dev/null +++ b/docker-host/setup/templates/proxy.conf.j2 @@ -0,0 +1,6 @@ +server { + server_name {{SERVER_NAME}}; + location / { + proxy_pass http://127.0.0.1:{{PORT}}; + } +} \ No newline at end of file