diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 4b39a95..65096c9 100755 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -62,8 +62,10 @@ export default defineComponent({ console.log(wurl) const connectWebSocket = () => { - ws = new WebSocket(`ws://${wurl}/go/ws`) - //ws = new WebSocket(`ws://127.0.0.1:8080/go/ws`) + if(wurl == 'localhost') + ws = new WebSocket(`ws://${wurl}/go/ws`) + else + ws = new WebSocket(`wss://${wurl}/go/ws`) ws.onmessage = (event) => { const response = JSON.parse(event.data) const value = response.value diff --git a/nginx/server/default b/nginx/server/default new file mode 100644 index 0000000..cdc2f37 --- /dev/null +++ b/nginx/server/default @@ -0,0 +1,61 @@ + +server { + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + server_name channel.twilightparadox.com; # managed by Certbot + + listen [::]:443 ssl ipv6only=on; # managed by Certbot + listen 443 ssl; # managed by Certbot + ssl_certificate /etc/letsencrypt/live/channel.twilightparadox.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/channel.twilightparadox.com/privkey.pem; # managed by Certbot + include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot + ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot + + location / { + proxy_pass http://127.0.0.1:3000; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + location /go/ { + proxy_pass http://127.0.0.1:8080/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + location /assets/ { + proxy_pass http://127.0.0.1:8080/assets/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } + location /go/ws { # is important here no slash in the end + proxy_pass http://127.0.0.1:8080/go/ws; # and here no slash in the end + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + +} +server { + if ($host = channel.twilightparadox.com) { + return 301 https://$host$request_uri; + } # managed by Certbot + + + listen 80 ; + listen [::]:80 ; + server_name channel.twilightparadox.com; + return 404; # managed by Certbot + + +}