Nginx: Increase client_max_body_size

Hi,

I have used the following url to setup/deploy OpenVidu:
https://docs.openvidu.io/en/2.15.0/deployment/deploying-on-premises/

And then used this to deploy my application on the same server successfully:
https://docs.openvidu.io/en/2.15.0/deployment/deploying-openvidu-apps/
(natively)

All well and good and OV is working fine with recording. But my application has a page that lets users upload an image and this image usually has a size > 5MB which is throwing the annoying “413 Request Entity too Large” error. We know that this can be resolved by setting the value for client_max_body_size in the nginx.conf file. Since my deployed application is running with OpenVidu on the same server and OpenVidu uses it’s own Nginx, my understanding is that I need to set the above value for this Nginx. The problem I don’t know how?

I have had a look at the generated files in var/lib/docker/overlay2/…/merged/etc/nginx/nginx.conf file. I assume this is the file generated for the OV docker because when I set the value here, the upload on my site starts functioning. The problem is that this is not persistent. When I do a ./openvidu restart, I lose this setting.

I also know that in order for me set this value permanently, I will need to modify the docker-compose.yaml file in opt/openvidu but I don’t know how. I simply want the value “client_max_body_size” set so it remains persistent even after the OV restart. Is this possible?

Thank you,
Abdullah

To anyone who is facing the same issue, I was able to resolve this by placing a copy of the “nginx.conf” file in /opt/openvidu. And then adding the following lines to the nginx section of docker-compose.xml:

    nginx:
        image: openvidu/openvidu-proxy:3.0.0
        restart: on-failure
        network_mode: host
        volumes:
            - ./certificates:/etc/letsencrypt
            - ./owncert:/owncert
            - ./nginx.conf:/etc/nginx/nginx.conf
            - ${OPENVIDU_RECORDING_CUSTOM_LAYOUT}:/opt/openvidu/custom-layout
        environment:
            - DOMAIN_OR_PUBLIC_IP=${DOMAIN_OR_PUBLIC_IP}
            - CERTIFICATE_TYPE=${CERTIFICATE_TYPE}
            - LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
            - PROXY_HTTP_PORT=${HTTP_PORT:-}
            - PROXY_HTTPS_PORT=${HTTPS_PORT:-}
            - ALLOWED_ACCESS_TO_DASHBOARD=${ALLOWED_ACCESS_TO_DASHBOARD:-}
            - ALLOWED_ACCESS_TO_RESTAPI=${ALLOWED_ACCESS_TO_RESTAPI:-}
            - PROXY_MODE=CE
            - WITH_APP=true
1 Like