ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Nginx SSL Certification + Nextcloud +Guacamole

    Scheduled Pinned Locked Moved IT Discussion
    nginx
    17 Posts 4 Posters 1.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch
      last edited by

      You cannot listen on both http and https in the same server block.

      wirestyle22W 1 Reply Last reply Reply Quote 1
      • wirestyle22W
        wirestyle22
        last edited by

        Ended up being the / at the end of proxy_pass. Hours of time looking for /

        1 Reply Last reply Reply Quote 0
        • wirestyle22W
          wirestyle22 @JaredBusch
          last edited by

          @jaredbusch said in Nginx SSL Certification + Nextcloud +Guacamole:

          You cannot listen on both http and https in the same server block.

          0_1535118428359_1.JPG

          JaredBuschJ 1 Reply Last reply Reply Quote 0
          • JaredBuschJ
            JaredBusch @wirestyle22
            last edited by

            @wirestyle22 said in Nginx SSL Certification + Nextcloud +Guacamole:

            @jaredbusch said in Nginx SSL Certification + Nextcloud +Guacamole:

            You cannot listen on both http and https in the same server block.

            0_1535118428359_1.JPG

            See how much I know when I never accept HTTP to begin with.

            wirestyle22W 1 Reply Last reply Reply Quote 1
            • wirestyle22W
              wirestyle22 @JaredBusch
              last edited by wirestyle22

              @jaredbusch said in Nginx SSL Certification + Nextcloud +Guacamole:

              @wirestyle22 said in Nginx SSL Certification + Nextcloud +Guacamole:

              @jaredbusch said in Nginx SSL Certification + Nextcloud +Guacamole:

              You cannot listen on both http and https in the same server block.

              0_1535118428359_1.JPG

              See how much I know when I never accept HTTP to begin with.

              I don't really get the use case honestly, but it's possible to do. After I test VNC tonight I'll force https.

              DustinB3403D 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @wirestyle22
                last edited by

                @wirestyle22 maybe as a redirect to HTTPS so that rather than hitting a dead service it sends it along to the appropriate place?

                wirestyle22W 1 Reply Last reply Reply Quote 3
                • wirestyle22W
                  wirestyle22 @DustinB3403
                  last edited by wirestyle22

                  @dustinb3403 I can understand that thought process. Have to look at some of @JaredBusch's Nextcloud guides to see how he did it.

                  1 Reply Last reply Reply Quote 0
                  • black3dynamiteB
                    black3dynamite
                    last edited by black3dynamite

                    I normally create two separate server blocks, one for listening port 80 and another for port 443.
                    Port 80 always gets redirected to 443.

                    wirestyle22W 1 Reply Last reply Reply Quote 1
                    • wirestyle22W
                      wirestyle22 @black3dynamite
                      last edited by wirestyle22

                      @black3dynamite If we use one of my configs as an example:

                      server {
                              client_max_body_size 40M;
                              listen 80;
                              server_name connect.domain.com;
                              return 301 https://$host$request_uri;
                              proxy_set_header X-Real-IP $remote_addr;
                              proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                              proxy_set_header Host $http_host;
                              proxy_set_header N-Nginx-Proxy true;
                              proxy_redirect off;
                              location / {
                                      proxy_set_header X-Real-IP $remote_addr;
                                      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                      proxy_set_header Host $http_host;
                                      proxy_set_header X-NginX-Proxy true;
                                      proxy_pass http://192.168.1.205:8080/guacamole/;
                                      proxy_redirect off;
                                      proxy_http_version 1.1;
                                      proxy_set_header Upgrade $http_upgrade;
                                      proxy_set_header Connection $http_connection;
                                      proxy_buffering off;
                              }
                      
                          listen 443 ssl; # managed by Certbot
                          ssl_certificate /etc/letsencrypt/live/connect.domain.com/fullchain.pem; # managed by Certbot
                          ssl_certificate_key /etc/letsencrypt/live/connect.domain.com/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
                      
                      }
                      

                      Correct? I don't think they need to be two separate server blocks. If there is some kind of benefit to doing it that way let me know.

                      JaredBuschJ black3dynamiteB 2 Replies Last reply Reply Quote 0
                      • JaredBuschJ
                        JaredBusch @wirestyle22
                        last edited by JaredBusch

                        @wirestyle22 said in Nginx SSL Certification + Nextcloud +Guacamole:

                        @black3dynamite If we use one of my configs as an example:

                        server {
                                client_max_body_size 40M;
                                listen 80;
                                server_name connect.domain.com;
                                return 301 https://$host$request_uri;
                                proxy_set_header X-Real-IP $remote_addr;
                                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                proxy_set_header Host $http_host;
                                proxy_set_header N-Nginx-Proxy true;
                                proxy_redirect off;
                                location / {
                                        proxy_set_header X-Real-IP $remote_addr;
                                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                        proxy_set_header Host $http_host;
                                        proxy_set_header X-NginX-Proxy true;
                                        proxy_pass http://192.168.1.205:8080/guacamole/;
                                        proxy_redirect off;
                                        proxy_http_version 1.1;
                                        proxy_set_header Upgrade $http_upgrade;
                                        proxy_set_header Connection $http_connection;
                                        proxy_buffering off;
                                }
                        
                            listen 443 ssl; # managed by Certbot
                            ssl_certificate /etc/letsencrypt/live/connect.domain.com/fullchain.pem; # managed by Certbot
                            ssl_certificate_key /etc/letsencrypt/live/connect.domain.com/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
                        
                        }
                        

                        Correct? I don't think they need to be two separate server blocks. If there is some kind of benefit to doing it that way let me know.

                        Last night you were not redirecting port 80 to 443. You are accepting both and proxying on.

                        wirestyle22W 1 Reply Last reply Reply Quote 0
                        • black3dynamiteB
                          black3dynamite @wirestyle22
                          last edited by

                          @wirestyle22

                          I just preferred to keep them separate.
                          Here is one of my configs for nextcloud where I use separate server blocks.

                          upstream backend-nextcloud-demo {
                              server nc-demo1:80;
                          }
                          
                          server {
                                  listen 80;
                                  listen [::]:80;
                                 
                                  server_name nc-demo.domain.com;
                          
                                  return 301 https://$host$request_uri;
                          }
                          
                          server {
                                  client_max_body_size 40M;
                                  listen 443 http2 ssl;
                                  listen [::]:443 http2 ssl;
                          
                                  server_name nc-demo.domain.com;
                          
                                  ssl on;
                                  ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
                                  ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
                                  ssl_dhparam /etc/ssl/certs/dhparam.pem;
                          
                          
                                  ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
                                  ssl_prefer_server_ciphers on;
                                  ssl_ciphers EECDH+CHACHA20:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
                                  ssl_ecdh_curve secp384r1;
                                  ssl_session_cache shared:SSL:10m;
                                  ssl_session_tickets off;
                                  ssl_stapling on;
                                  ssl_stapling_verify on;
                                  resolver 1.1.1.1 8.8.8.8 valid=300s;
                                  resolver_timeout 5s;
                                  add_header Strict-Transport-Security "max-age=63072000; includeSubdomains; preload";
                          #       add_header X-Content-Type-Options nosniff;
                          #       add_header X-Frame-Options SAMEORIGIN;
                          #       add_header X-Robots-Tag none;
                          #       add_header X-XSS-Protection "1; mode=block";
                          
                                  location / {
                                          proxy_set_header X-Real-IP $remote_addr;
                                          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                          proxy_set_header Host $http_host;
                                          proxy_set_header X-NginX-Proxy true;
                                          proxy_pass http://backend-nextcloud-demo;
                                          proxy_redirect off;
                                          proxy_connect_timeout 600;
                                          proxy_send_timeout 600;
                                          proxy_read_timeout 600;
                                          send_timeout 600;
                                  }
                          
                          wirestyle22W 1 Reply Last reply Reply Quote 1
                          • wirestyle22W
                            wirestyle22 @JaredBusch
                            last edited by

                            @jaredbusch said in Nginx SSL Certification + Nextcloud +Guacamole:

                            @wirestyle22 said in Nginx SSL Certification + Nextcloud +Guacamole:

                            @black3dynamite If we use one of my configs as an example:

                            server {
                                    client_max_body_size 40M;
                                    listen 80;
                                    server_name connect.domain.com;
                                    return 301 https://$host$request_uri;
                                    proxy_set_header X-Real-IP $remote_addr;
                                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                    proxy_set_header Host $http_host;
                                    proxy_set_header N-Nginx-Proxy true;
                                    proxy_redirect off;
                                    location / {
                                            proxy_set_header X-Real-IP $remote_addr;
                                            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                                            proxy_set_header Host $http_host;
                                            proxy_set_header X-NginX-Proxy true;
                                            proxy_pass http://192.168.1.205:8080/guacamole/;
                                            proxy_redirect off;
                                            proxy_http_version 1.1;
                                            proxy_set_header Upgrade $http_upgrade;
                                            proxy_set_header Connection $http_connection;
                                            proxy_buffering off;
                                    }
                            
                                listen 443 ssl; # managed by Certbot
                                ssl_certificate /etc/letsencrypt/live/connect.domain.com/fullchain.pem; # managed by Certbot
                                ssl_certificate_key /etc/letsencrypt/live/connect.domain.com/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
                            
                            }
                            

                            Correct? I don't think they need to be two separate server blocks. If there is some kind of benefit to doing it that way let me know.

                            Last night you were not redirecting port 80 to 443. You are accepting both and proxying on.

                            Right, but the quoted config is how i would redirect. I didn't change the initial post configs.

                            1 Reply Last reply Reply Quote 0
                            • wirestyle22W
                              wirestyle22 @black3dynamite
                              last edited by

                              @black3dynamite Thanks dude

                              1 Reply Last reply Reply Quote 0
                              • wirestyle22W
                                wirestyle22
                                last edited by

                                Hm. I can still access via http

                                JaredBuschJ 1 Reply Last reply Reply Quote 0
                                • JaredBuschJ
                                  JaredBusch @wirestyle22
                                  last edited by

                                  @wirestyle22 said in Nginx SSL Certification + Nextcloud +Guacamole:

                                  Hm. I can still access via http

                                  I use a rewrite

                                  server {
                                      client_max_body_size 40M;
                                      listen 80;
                                      server_name nc.domain.com;
                                      rewrite        ^ https://\$server_name\$request_uri? permanent;
                                  }
                                  
                                  wirestyle22W 1 Reply Last reply Reply Quote 3
                                  • wirestyle22W
                                    wirestyle22 @JaredBusch
                                    last edited by wirestyle22

                                    @jaredbusch Hm. I'm getting too many rewrite errors now. Some odd problems occurring. Relative pathing problem?

                                    1 Reply Last reply Reply Quote 0
                                    • 1 / 1
                                    • First post
                                      Last post