https installed

This commit is contained in:
H3XploR
2026-03-24 14:29:04 +01:00
parent 801750da96
commit 13f93fb332
5 changed files with 25 additions and 6 deletions
+2 -1
View File
@@ -38,7 +38,8 @@ services:
container_name: frontend container_name: frontend
build: ./srcs/frontend/ build: ./srcs/frontend/
ports: ports:
- "8080:80" - "8080:8080"
- "8443:8443"
depends_on: depends_on:
- backend - backend
networks: networks:
+8 -1
View File
@@ -1,5 +1,12 @@
FROM nginx:alpine FROM nginx:alpine
RUN apk add --no-cache openssl && \
mkdir -p /etc/nginx/ssl && \
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout /etc/nginx/ssl/key.pem \
-out /etc/nginx/ssl/cert.pem \
-subj "/CN=localhost" \
-addext "subjectAltName=DNS:localhost,IP:127.0.0.1"
COPY src /usr/share/nginx/html COPY src /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 8080 8443
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
+13 -2
View File
@@ -1,5 +1,13 @@
server { server {
listen 80; listen 8080;
return 301 https://$host:8443$request_uri;
}
server {
listen 8443 ssl;
ssl_certificate /etc/nginx/ssl/cert.pem;
ssl_certificate_key /etc/nginx/ssl/key.pem;
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
@@ -14,6 +22,7 @@ server {
proxy_pass http://backend:3001; proxy_pass http://backend:3001;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto https;
} }
# Socket.IO WebSocket proxying # Socket.IO WebSocket proxying
@@ -25,7 +34,9 @@ server {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
} }
location /avatar/ { location /avatar/ {
@@ -718,7 +718,7 @@ export class GameRoomWindow extends Window {
const altPort = window.GLOBAL_CHAT_ALT_PORT; const altPort = window.GLOBAL_CHAT_ALT_PORT;
if (altPort) { if (altPort) {
const host = location.hostname || 'localhost'; const host = location.hostname || 'localhost';
this.socket = io(`http://${host}:${altPort}`, ioConfig); this.socket = io(`${location.protocol}//${host}:${altPort}`, ioConfig);
} else { } else {
this.socket = io(ioConfig); this.socket = io(ioConfig);
} }
@@ -222,7 +222,7 @@ export class GlobalChat extends Window {
const altPort = window.GLOBAL_CHAT_ALT_PORT; const altPort = window.GLOBAL_CHAT_ALT_PORT;
if (altPort) { if (altPort) {
const host = location.hostname || 'localhost'; const host = location.hostname || 'localhost';
this.socket = io(`http://${host}:${altPort}`, ioConfig); this.socket = io(`${location.protocol}//${host}:${altPort}`, ioConfig);
} else { } else {
this.socket = io(ioConfig); this.socket = io(ioConfig);
} }