0

i tried to pass the nextcloud docker with apache through nginx with a subdomain. But i still recieve the index.html from the main site.

    server {
            listen 80 default_server;
            listen [::]:80 default_server;
    
            root /var/www/html;
    
            # Add index.php to the list if you are using PHP
            index index.html index.htm index.nginx-debian.html index.php;
    
            server_name _;
            location /.well-known/acme-challenge/ {
                root /var/www/certbot;
            }
    
            location / {
                    try_files $uri $uri/ =404;
            }
    
            location ~ /\.ht {
                   deny all;
            }
    }
    
    server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
    
        server_name nextcloud.domain.tl;
    
        client_max_body_size 0;
        underscores_in_headers on;
        
        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_set_header X-Forwarded-Proto $scheme;
                add_header Front-End-Https on;
    
                proxy_headers_hash_max_size 512;
                proxy_headers_hash_bucket_size 64;
    
                proxy_buffering off;
                proxy_redirect off;
                proxy_max_temp_file_size 0;
                proxy_pass http://192.168.1.100:8080;
            }
    
            ssl_certificate /etc/letsencrypt/live/domain.tl-0001/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/domain.tl-0001/privkey.pem;
            include /etc/letsencrypt/options-ssl-nginx.conf;
            ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
        
    }
    
    server {
            listen 443 ssl;
            server_name domain.tl;
    
            ssl_certificate /etc/letsencrypt/live/domain.tl-0001/fullchain.pem;
            ssl_certificate_key /etc/letsencrypt/live/domain.tl-0001/privkey.pem;
            include /etc/letsencrypt/options-ssl-nginx.conf;
            ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
    
            root /var/www/html;
    
            location ~ /nextcloud {
                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-Proto $scheme;
                proxy_set_header X-Forwarded-Host $server_name;
                client_max_body_size 1G;
                proxy_pass http://192.168.1.100:8080;
        }
    }

for the proxy_pass i added truste_proxies and overwrite in the enviroments

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - /home/user/docker/nextcloud/nextcloud/data:/var/www/html
    environment:
      - MYSQL_PASSWORD=pass1
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - PHP_UPLOAD_LIMIT=2048
      - APACHE_DISABLE_REWRITE_IP=1
      - TRUSTED_PROXIES=192.168.0.0/16
      - OVERWRITECLIURL=https://nextcloud.domain.tl

when i go to https://nextcloud.domain.tl i got the index.html from domain.tl

1 Answer 1

0

Don't you have to expose port 443 in your docker-compose as well?

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
      - 443:443        # or whichever external port you want...
    links:
      - db
    volumes:
      - /home/user/docker/nextcloud/nextcloud/data:/var/www/html
    environment:
      - MYSQL_PASSWORD=pass1
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - PHP_UPLOAD_LIMIT=2048
      - APACHE_DISABLE_REWRITE_IP=1
      - TRUSTED_PROXIES=192.168.0.0/16
      - OVERWRITECLIURL=https://nextcloud.domain.tl

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .