Hi there,
currently I'm struggeling in defining multible entrypoints. Basicly I want to listen on port 443 and 8090.
My old rev proxy is running on NGINX and I want to recreate the rule according to my config. I'm not sure how to make both entrypoints visible.
Does anyone know how to transfer this old NGINX config?
Thank you.
default.conf
upstream test.example.com_http {
# Http newprojects
server test:8080;
}
upstream test.example.com_socketio {
# Socket.io newprojects
server test:8091;
}
server {
server_name test.example.com;
listen 80;
access_log /var/log/nginx/access.log vhost;
return 301 https://$host$request_uri;
}
server {
server_name test.example.com;
listen 443 ssl http2;
access_log /var/log/nginx/access.log vhost;
include "conf.d/ssl.nginx-include";
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
add_header Strict-Transport-Security "max-age=31536000";
location / {
include "conf.d/cors.nginx-include";
location = / {
return 302 https://$host/UserInterface/;
}
proxy_connect_timeout 600;
proxy_send_timeout 86400;
proxy_read_timeout 86400;
send_timeout 600;
client_max_body_size 200m;
proxy_pass http://test.example.com_http;
}
}
server {
server_name test.example.com;
listen 8090 ssl http2;
access_log /var/log/nginx/access.log vhost;
include "conf.d/ssl.nginx-include";
ssl_certificate /etc/nginx/certs/default.crt;
ssl_certificate_key /etc/nginx/certs/default.key;
add_header Strict-Transport-Security "max-age=31536000";
location / {
proxy_pass http://test.example.com_socketio;
}
}
docker-compose.yml
services:
traefik:
container_name: traefik
image: traefik
restart: always
command:
#- "--log.level=DEBUG"
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --entrypoints.socketio.address=:8090
- --providers.docker
- --api
- --api.insecure
- --providers.file.directory=/configuration/
- --providers.file.watch=true
ports:
- 80:80
- 443:443
- 8090:8090 # SocketIO
- 8080:8080 # Management Board
networks:
- web
- internal
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs/:/certs/
- ./traefik/configuration/:/configuration/
labels:
# global redirect to https
- "traefik.http.routers.redirs.rule=hostregexp(`{host:.+}`)"
- "traefik.http.routers.redirs.entrypoints=web"
- "traefik.http.routers.redirs.middlewares=redirect-to-https"
# middleware redirect
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
test:
container_name: test
image: test
restart: always
networks:
- web
labels:
# Traefik
- "traefik.enable=true"
- "traefik.http.routers.test.rule=Host(`test.example.com`)"
- "traefik.http.routers.test.entrypoints=websecure"
- "traefik.http.routers.test.tls=true"
- "traefik.http.services.test.loadbalancer.server.port=8080"
# # SocketIO
# - "traefik.http.routers.test_websocket.rule=Host(`test.example.com`)"
# - "traefik.http.routers.test_websocket.entrypoints=socketio"
# - "traefik.http.routers.test_websocket.tls=true"
# - "traefik.http.services.test_websocket.loadbalancer.server.port=8091"
# Traefik Redirect
- "traefik.http.middlewares.userinterface-redirect-test.redirectregex.regex=https://test.example.com/$${1}"
- "traefik.http.middlewares.userinterface-redirect-test.redirectregex.replacement=https://test.example.com/UserInterface$${1}"
- "traefik.http.middlewares.userinterface-redirect-test.redirectregex.permanent=true"
- "traefik.http.routers.test.middlewares=userinterface-redirect-test"
# Traefik Security Headers
- "traefik.http.middlewares.test.headers.customrequestheaders.X-Forwarded-Proto=https"