mirror of
https://github.com/daniviga/bite.git
synced 2024-12-23 08:41:24 +01:00
Use nginx by default as ingress (#16)
This commit is contained in:
parent
8e71d64f8f
commit
454c4b43cf
@ -2,7 +2,7 @@ version: "3.7"
|
||||
|
||||
services:
|
||||
ingress:
|
||||
command: --providers.docker
|
||||
# command: --providers.docker # For traefik only
|
||||
ports:
|
||||
- "80:80"
|
||||
|
||||
|
@ -42,16 +42,27 @@ services:
|
||||
|
||||
ingress:
|
||||
<<: *service_default
|
||||
image: traefik:v2.2
|
||||
command: --api.insecure=true --providers.docker
|
||||
image: nginx:stable-alpine
|
||||
ports:
|
||||
- "8000:80"
|
||||
- "8080:8080"
|
||||
networks:
|
||||
- net
|
||||
volumes:
|
||||
# So that Traefik can listen to the Docker events
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
|
||||
# User traefix instead of nginx
|
||||
# ingress:
|
||||
# <<: *service_default
|
||||
# image: traefik:v2.2
|
||||
# command: --api.insecure=true --providers.docker
|
||||
# ports:
|
||||
# - "8000:80"
|
||||
# - "8080:8080"
|
||||
# networks:
|
||||
# - net
|
||||
# volumes:
|
||||
# # So that Traefik can listen to the Docker events
|
||||
# - /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
bite:
|
||||
<<: *service_default
|
||||
|
59
docker/nginx/nginx.conf
Normal file
59
docker/nginx/nginx.conf
Normal file
@ -0,0 +1,59 @@
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /dev/stdout warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /dev/stdout main;
|
||||
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
gzip off;
|
||||
|
||||
upstream bite {
|
||||
# We point to the Docker 'service' instead of directly to the container
|
||||
# Docker does then a DNS round-robin internally
|
||||
server bite:8000;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name _;
|
||||
|
||||
keepalive_requests 10;
|
||||
keepalive_timeout 60 60;
|
||||
|
||||
location / {
|
||||
proxy_pass http://bite;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Host $host:$server_port;
|
||||
proxy_set_header X-Forwarded-Server $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
proxy_read_timeout 300;
|
||||
proxy_connect_timeout 300;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user