You are not logged in.

#1 2021-05-22 16:37:39

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

[Solved]Docker how to link jwilder/nginx to ttrss-docker and nextcloud

Dear all,

I already got a tt-rss installation on a apache virtualhost and letsencrypt, but now I want to install second application nextcloud on another virtualhost. My contraints is that I have only one computer, one ip and one domain. I can't manage subdomain and I don't want to use different port. I would like to use path location too reach the two services separately like this:
    https:\my_registered_domain\ttrsss\
    https:\my_registered_domain\nextcloud\

I’m trying using docker-compose to use docker jwilder/nginx and two static server and I didn’t find how can I reach the two static servers using path location. It seems to be possible when I look at jwilder/nginx documentation (per_VIRTUALHOST location) but I don’t understand how.

Otherwise, I can modifiy my already existing apache configuration, but I don't know how to manage virtualhost to use path location.

Can someone help me please?

Regards

Last edited by Bob le pirate (2021-05-26 16:54:09)

Offline

#2 2021-05-22 17:01:04

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: [Solved]Docker how to link jwilder/nginx to ttrss-docker and nextcloud

If both docker containers come with their own web server, then you need to set up a third nginx instance as a reverse proxy to the two other servers and not use virtualhosts.
Then you might have to tell the other two servers the correct domain inclusive subdomain to embed into the page, and maybe pass HTTP_X_FORWARDED_PROTO if the internal connections are not ssl encrypted.

https://community.tt-rss.org/t/tt-rss-i … -proxy/850
https://github.com/nextcloud/docker/issues/401

Edit: You'd have to modify jwilder/nginx-proxy, since it isn't set up for that. One old example might be https://hub.docker.com/r/theit8514/ngin … bdirectory

Last edited by progandy (2021-05-22 17:19:56)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#3 2021-05-22 19:14:18

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

Re: [Solved]Docker how to link jwilder/nginx to ttrss-docker and nextcloud

Thank you very much.

I will try to understand how modify jwilder/nginx in order to use HTTP_X_FORWARDED_PROTO.
May be i will ask you later if i didn't find how to modify nginx.

Regards.

Offline

#4 2021-05-23 12:17:19

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

Re: [Solved]Docker how to link jwilder/nginx to ttrss-docker and nextcloud

Damned, i did found how those dockers work...

I've got my jwilder/nginx reverse proxy working fine (I tried it with a static page served pay a docker nginx:alpine)
I've got my tt-rss-docker working on localhost:8280
But I don't understand how to connect both...

Here is my docker-compose.yaml for jwilder/nginx reverse proxy

services: 
  # Nginx
  nginx-reverse-proxy:
    image: jwilder/nginx-proxy:latest
    container_name: nginx-reverse-proxy
    restart: always
    ports:
        - "80:80"
        - "443:443"
    volumes:
        - ./conf.d:/etc/nginx/conf.d
        - ./certs:/etc/nginx/certs:ro
        - ./vhost.d:/etc/nginx/vhost.d
        - /usr/share/nginx/html
        - /var/run/docker.sock:/tmp/docker.sock:ro
    labels:
        - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy

  # Let's Encrypt
  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion:latest
    restart: always
    volumes_from:
        - nginx-reverse-proxy
    container_name: letsencrypt
    volumes:
        - ./certs:/etc/nginx/certs:rw
        - /var/run/docker.sock:/var/run/docker.sock:ro
        - acme:/etc/acme.sh
                  
volumes:
  conf.d:
  vhost.d:
  certs:
  acme:

I also add in conf.d a proxy_location file

location /tt-rss/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://127.0.0.1:8280/tt-rss/;
    break;
}

And on ttrss-docker side, I've got the original coming from https://git.tt-rss.org/fox/ttrss-docker-compose.
I just modify the.env file

# Copy this file to .env before building the container.
# Put any local modifications here.

TTRSS_DB_USER=postgres
TTRSS_DB_NAME=postgres
TTRSS_DB_PASS=password

# This is only used by web-ssl container.
#HTTP_HOST=localhost

# You will likely need to set this to the correct value, see README.md
# for more information.
TTRSS_SELF_URL_PATH=https://my_registered_domain/tt-rss

# You can customize other config.php defines by setting overrides here.
# See app/Dockerfile for complete list. Examples:
# TTRSS_PLUGINS=auth_remote
# TTRSS_SINGLE_USER_MODE=true
# TTRSS_SESSION_COOKIE_LIFETIME=2592000
# TTRSS_FORCE_ARTICLE_PURGE=30
# etc, etc.

# bind exposed port to 127.0.0.1 by default in case reverse proxy is used.
# if you plan to run the container standalone and need origin port exposed
# use next HTTP_PORT definition (or remove "127.0.0.1:").
HTTP_PORT=127.0.0.1:8280
#HTTP_PORT=8280

# Let's encrypt
VIRTUAL_HOST=my_registered_domain
VIRTUAL_PORT=80
LETSENCRYPT_HOST=my_registered_domain
LETSENCRYPT_EMAIL=my_registered_email

Can someone help me, I don't know how to link ttrss-docker to jwilder/nginx.

Regards

Offline

#5 2021-05-26 16:53:36

Bob le pirate
Member
Registered: 2014-03-07
Posts: 10

Re: [Solved]Docker how to link jwilder/nginx to ttrss-docker and nextcloud

Dear all,

Finally I 've got the solution (may be someone could be interested).

Here is my docker-compose.yaml for jwilder/nginx reverse proxy

services: 
  # Nginx
  nginx-reverse-proxy:
    image: jwilder/nginx-proxy:latest
    container_name: nginx-reverse-proxy
    restart: always
    ports:
        - "80:80"
        - "443:443"
    volumes:
        - ./certs:/etc/nginx/certs:ro
        - ./vhost.d:/etc/nginx/vhost.d
        - /usr/share/nginx/html
        - dhparam:/etc/nginx/dhparam
        - /var/run/docker.sock:/tmp/docker.sock:ro
        - ./htpass:/etc/nginx/htpasswd
    labels:
        - com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy
    networks: ["net"]
        
  # Let's Encrypt
  letsencrypt-nginx-proxy-companion:
    image: jrcs/letsencrypt-nginx-proxy-companion:latest
    restart: always
    volumes_from:
        - nginx-reverse-proxy
    container_name: letsencrypt
    volumes:
        - ./certs:/etc/nginx/certs:rw
        - /var/run/docker.sock:/var/run/docker.sock:ro
        - acme:/etc/acme.sh
    networks: ["net"]

volumes:
  vhost.d:
  certs:
  dhparam:
  acme:
  htpass:

networks:
  net:
    external: true

And in the vhost.d directory the file "default_location" (name of the file is important).

location /tt-rss/ {
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_pass http://ttrss-docker_web-nginx_1/tt-rss/;
    break;
}

I also had "net" network to cthulhoo/ttrss-web-nginx and "common" to all the dockers inside ttrss docker.
And it works fine.

Regards.

Offline

Board footer

Powered by FluxBB