movim / movim_docker

Official Docker Compose stack for Movim, maintained by @kawaii and the @movim team
https://movim.eu/
GNU Affero General Public License v3.0
79 stars 29 forks source link

Problem permission denied tcp 80 #23

Closed opalinemustiere closed 1 year ago

opalinemustiere commented 4 years ago

Hi, This is my config :

So, in the stack.yml, I've set the DATABASE HOST with the docker.host IP (docker.host.internal did not work/was not interpreted, so I had to find and use the IP of docker interface and then it worked). Anyway, this part worked (db tables installed in the docker.host database).

But then, I had a problem with the MOVIM_PORT (I've let the 8080 port), I'm not sure of the expected behaviour : => Once I ran the containers, I was able to access to http://.com:80 but the problem was that it did print the Nginx Default Page ... and not Movim. => Also, when I set port 80 in MOVIM_PORT conf, it returns me a permission denied.

How could this work ( <=> Why MOVIM_PORT is set on 8080 and Why :80 nginx port does not print /var/www/html MOVIM but a default nginx page ?) And what can I do ?

PS : I'm not very comfortable with english and dev-ops, sorry for that. Thank you

paulb-smartit commented 3 years ago

Did you mount an nginx.conf into the nginx container?

If you are using the docker-compose.yml you need to put and nginx.conf file into ${PWD}/nginx

Here's an example of the one I use:

upstream movim-http {
    server movim:9000;
}
upstream movim-ws {
    server movim:8080;
}

fastcgi_cache_path /tmp/nginx_cache levels=1:2 keys_zone=nginx_cache:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";

server {
    listen 80;
    server_name localhost;

    index index.php index.html;

    root /var/www/html/public;

    location / {
        try_files $uri /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass movim-http;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }

    location /ws/ {
        proxy_pass http://movim-ws;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        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 https;
        proxy_redirect off;
    }

    location /picture {
        include fastcgi_params;

        add_header X-Cache $upstream_cache_status;
        fastcgi_ignore_headers "Cache-Control" "Expires" "Set-Cookie";
        fastcgi_cache nginx_cache;
        fastcgi_cache_key $request_method$host$request_uri;
        fastcgi_cache_valid any 1h;
    }
}

This then tells the nginx container how to forward requests to movim.