Struggle with nginx and letsencrypt

I have installed a nginx server which serves two site one.dev and two.com.
This two website work with https and is fully functional.

I want to install a owncloud server serve by a subdomain oc.one.dev.

I have done/installed :

  • mariadb
  • nginx (already installed since few month btw…)
  • php :
    • php7.4-fpm
    • php7.4-common
    • php7.4-mysql
    • php7.4-gmp
    • php7.4-curl
    • php7.4-intl
    • php7.4-mbstring
    • php7.4-xmlrpc
    • php7.4-gd
    • php7.4-xml
    • php7.4-cli
    • php7.4-zip
  • create and set owncloud database
  • dl and mv lastest owncloud version to /var/www/owncloud
  • set chmod/own
    • sudo chown -R www-data:www-data /var/www/owncloud/
    • sudo chmod -R 755 /var/www/owncloud/

Next to that i have created a subdomain in my dns : oc IN A SAME.IP.AS.ONE.DEV

I setup the owncloud host :

server {
    server_name your_domain;

    access_log /var/log/nginx/your_domain-access.log;
    error_log /var/log/nginx/your_domain-error.log;
    root /var/www/html/owncloud;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Here the oc.one.dev redirect to one.dev.

Next to that i run sudo certbot --nginx, here i set the cert. for oc.one.dev.
Now my host look like that :

server {
    server_name oc.one.dev;

    access_log /var/log/nginx/oc.one.dev-access.log;
    error_log /var/log/nginx/oc.one.dev-error.log;
    root /var/www/owncloud;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/oc.one.dev/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/oc.one.dev/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

}
server {
    if ($host = oc.one.dev) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name oc.one.dev;
    listen 80;
    return 404; # managed by Certbot


}

Now i have a 502 bad gateway in oc.one.dev, for information one.dev and two.com work fine.

Thanks for your help.

if you need other information feel free to ask.