• Applications
  • [Discussion] Certificat SSL signé et gratuit avec Let's Encrypt

balbao
Salut
si tu as utilisé le derniere version de manager ta conf doit pas du tout ressemblé a ça.
deja il te manque
root /var/www;
je vais essaye de tant faire un.

balbao
si tu veux test cette version de conf.

server {
	listen 80 default_server;
	listen 443 default_server ssl http2;
	server_name _;

	index index.html index.php;
	charset utf-8;
	client_max_body_size 10M;

	ssl_certificate /etc/letsencrypt/live/monsite.com/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/monsite.com/privkey.pem;

	include /etc/nginx/conf.d/ciphers.conf;

	access_log /var/log/nginx/rutorrent-access.log combined;
	error_log /var/log/nginx/rutorrent-error.log error;

	error_page 500 502 503 504 /50x.html;

	auth_basic "seedbox";
	auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";

	root /var/www;

	location = /favicon.ico {
		access_log off;
		log_not_found off;
	}

	location = /50x.html {
		root /usr/share/nginx/html;
	}

	location ~ \.php$ {
		fastcgi_index index.php;
		include /etc/nginx/fastcgi_params;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
	}

	location ~* \.(jpg|jpeg|gif|css|png|js|map|woff|woff2|ttf|svg|eot)$ {
		expires 30d;
		access_log off;
	}

	location ~* \.(eot|ttf|woff|svg)$ {
		add_header Acccess-Control-Allow-Origin *;
	}

	## Config accueil serveur ##

	location ^~ / {
		root /var/www/base;
		include /etc/nginx/conf.d/php.conf;
		include /etc/nginx/conf.d/cache.conf;
		satisfy any;
		allow all;
	}

	## Config rutorrent ##

	location /rutorrent {
		try_files $uri $uri/ /index.html;
	}

	location ~ ^/rutorrent/(conf|share)/(.+)$ {
		deny all;
	}

	## Config seedbox-manager ##

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

	## Config utilisateurs ##

            location /BALBAO {
            include scgi_params;
            scgi_pass 127.0.0.1:5001; #ou socket : unix:/home/username/.session/username.socket
            auth_basic "seedbox";
            auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_balbao";
        }

        location /USER1 {
            include scgi_params;
            scgi_pass 127.0.0.1:5003; #ou socket : unix:/home/username/.session/username.socket
            auth_basic "seedbox";
            auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user1";
        }

        location /USER2 {
            include scgi_params;
            scgi_pass 127.0.0.1:5004; #ou socket : unix:/home/username/.session/username.socket
            auth_basic "seedbox";
            auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user2";
        }

        location /USER3 {
            include scgi_params;
            scgi_pass 127.0.0.1:5005; #ou socket : unix:/home/username/.session/username.socket
            auth_basic "seedbox";
            auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd_user3";
        }

    }

Au final de l'installation du script j'ai ce message d'erreur au redémarrage de nginx :

service nginx restart

Erreur >
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details

J'ai fait: service nginx status -l

 nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: failed (Result: exit-code) since Tue 2017-10-10 17:07:50 CEST; 18min ago
     Docs: man:nginx(8)
  Process: 1450 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
 Main PID: 4695 (code=exited, status=0/SUCCESS)

Oct 10 17:07:50 113500HD010180 nginx[1450]: nginx: [emerg] invalid number of arguments in "ssl_certificate" directive in /etc/nginx/sites-enabled/seedbox.conf:4
Oct 10 17:07:50 113500HD010180 nginx[1450]: nginx: configuration file /etc/nginx/nginx.conf test failed
Oct 10 17:07:50 113500HD010180 systemd[1]: nginx.service: control process exited, code=exited status=1
Oct 10 17:07:50 113500HD010180 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Oct 10 17:07:50 113500HD010180 systemd[1]: Unit nginx.service entered failed state.
Oct 10 17:26:10 113500HD010180 systemd[1]: Stopped A high performance web server and a reverse proxy server.

@xavier

Merci pour cette conf. Cela fonctionne très bien

    balbao
    Après a toi de mettre ton nom de domaine et faire une redirection automatique sur le https .

    Oui c'est ce que j'ai fait. J'ai pas utilisé la config exactement comme ça. Mais tout fonctionne maintenant.

      balbao enfaite avec manager 2.5 ta conf devait être bonne.mais avec la version 3 il te faut ma conf.

      @Wagner

      Merci. C'est effectivement 2 erreurs dans la ligne ssl_certificate + ssl_certificate_key: un espace inséré après l'adresse de mon site. Pourtant j'ai regardé et reregardé cette config......
      Mon status de nginx est au vert ))))

      Petite question:
      Comment as-tu pu repéré ce genre d'erreur ?

      En tout cas mille et un mercis encore.

      De rien @Peerotechnik, dès fois c'est juste grâce au(x) message(s) et quand c'est possible je me base aussi sur mon expérience (ou mes souvenirs).

      un mois plus tard

      Bonjour.

      Sur un installation propre de Stretch et après avoir suivi ce tuto Installer ruTorrent sur Debian 9 j'essai d'installer un certificat ssl.
      Mais j'ai une erreur au redémarrage de nginx.
      Le statut de nginx :

      systemd[1]: Starting nginx - high performance web server...
      nginx[17207]: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/sites-enabled/seedbox.conf:23
      nginx[17207]: nginx: configuration file /etc/nginx/nginx.conf test failed
      systemd[1]: nginx.service: Control process exited, code=exited status=1
      systemd[1]: Failed to start nginx - high performance web server.
      systemd[1]: nginx.service: Unit entered failed state.
      systemd[1]: nginx.service: Failed with result 'exit-code'.
      

      Le début de mon sites-enabled/rutorrent.conf :

      server {
          listen 80 default_server;
          listen 443 default_server ssl http2;
          server_name mon.domain.fr;
          ssl_certificate /etc/letsencrypt/live/mon.domain.fr/fullchain.p$
          ssl_certificate_key /etc/letsencrypt/live/mon.domain.fr/privkey$
      
      }
          charset utf-8;
          index index.html index.php;
          client_max_body_size 10M;
      
      access_log /var/log/nginx/rutorrent-access.log combined;
      error_log /var/log/nginx/rutorrent-error.log error;
      
      error_page 500 502 503 504 /50x.html;
      
      auth_basic "seedbox";
      auth_basic_user_file "/etc/nginx/passwd/rutorrent_passwd";
      
      root /var/www;
      
       location = /50x.html {
          root /usr/share/nginx/html;
      }  

      Et un /etc/letsencrypt/live/mon.domain.fr# ls -l me renvoi

       
      -bash: /etc/letsencrypt/live/mon.domain.fr#: No such file or directory

      Merci pour votre aide.

      7 jours plus tard

      Bonsoir. Finalement affaire résolu.
      Un problème avec le nom de domaine.

      8 jours plus tard

      Salut,
      j'ai suivi les tutos pour installer rutorrent sous debian 9, puis le tuto pour le certificat SSL signé... mais autant j'avais pas de problème d'accès après le premier tuto, mais maintenant je ne peux plus accéder à mondomaine.ovh/rutorrent du tout. J'ai une erreur, la connexion a échoué. Par où commencer ? merci

      2 mois plus tard

      Bonjour 🙂
      Est-ce que quelqu'un aurait un mini tuto pour la mise en place du renouvellement automatique ?
      Merci !

        4 jours plus tard

        Bonjour
        J'ai un problème pour renouveler le certificat SSL

        service nginx stop
        ./certbot-auto renew
        service nginx start
        

        J'ai ce message d'erreur qui apparaît

        -bash: ./certbot-auto: No such file or directory

        Une petite solution ?

        Bonjour,

        Tu dois te situer dans le dossier ou est installé certbot-auto.

        Surement /opt/certbot-auto/ ou sinon tu dois saisir le chemin complet dans ta commande

        J'ai fait une recherche du dossier/fichier certbot-auto dans divers dosssier (/home /opt /root ....)

        find /<DOSSIER>/  certbot-auto

        La réponse reste : find: `certbot-auto': No such file or directory

        Possible qu'il ne soit plus présent ?

          Peerotechnik

          Tu n'es pas ou plus dans le dossier qui contient certbot-auto (il s'agit du dossier /tmp d'après ce tuto) ou tu l'as supprimé (ou le système a vidé /tmp).

          Tente de refaire d'abord les 1ères étapes du tuto :

          service nginx stop
          
          apt-get update && apt-get upgrade
          
          cd /tmp
          wget https://dl.eff.org/certbot-auto
          chmod a+x ./certbot-auto
          ./certbot-auto --help all
          ./certbot-auto renew
          service nginx start

            Que faut t'il faire si l'on souhaite ajouter un "sous" domaine à un certificat actuel? Il faut tout supprimer et recommencer? Si oui comment on supprime? Ou alors on peut ajouter un sous-domaine à un certificat existant?

            Hum.. je pense que je suis sur la voie avec

            --expand tells Certbot to update an existing certificate with a new certificate that contains all of the old domains and one or more additional new domains. With the --expand option, use the -d option to specify all existing domains and one or more new domains.

            Je vais essayer