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

    Install Nginx as a Reverse Proxy on Fedora 27

    Scheduled Pinned Locked Moved IT Discussion
    nginxfedoracertbotfedora 27reverse proxyguidesreal instructionshow to
    107 Posts 16 Posters 25.5k 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.
    • EddieJenningsE
      EddieJennings
      last edited by EddieJennings

      This guide has worked perfectly for me -- great for learning as well, as I had a chance to take pieces and look them up.

      Just to make sure my thinking is right, tell me if this is what's happening if I try to reach my site using HTTP.

      URL for the example is http://testweb1.ejsllc.com

      1. Request gets to the reverseproxy.
      2. Request does not match the first server block, as it is specifically listening on port 443.
      3. Request does match the second server block since server_name matches and it's listening on port 80.
      4. The second server block rewrites the URL to use https.
      5. The reverse proxy now evaluates the request again, which is now written as https://testweb1.ejsllc.com.
      6. Since no port was specified in the request, reverse proxy assumes the port will be 443, which will match the first server block, which is specifically listening on 443 and matches the server_name.
      7. The reverse proxy unencrypts the request and follows theproxy_pass directive to send it to http://SERVER_IP.
      8. SERVER_IPis listening on port 80, receives the unencrypted request, processes it, and sends the response back to the reverse proxy.
      9. The reverse proxy encrypts the response and send its back to the original requester.
      JaredBuschJ wirestyle22W 2 Replies Last reply Reply Quote 3
      • JaredBuschJ
        JaredBusch @EddieJennings
        last edited by

        @eddiejennings Correct.

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

          @JaredBusch This is from the Nginx website under pitfalls and common mistakes. I read that return's are much faster than rewrites due to not needing to evaluate RegEx(?) which is why you see return listed as a better option. I know you use rewrite and there's a lot you know that I don't so I was just wondering why that is your preference

          0_1536070111587_Capture.PNG

          JaredBuschJ 1 Reply Last reply Reply Quote 0
          • A
            Alex Sage @JaredBusch
            last edited by Alex Sage

            @jaredbusch said in Install Nginx as a Reverse Proxy on Fedora 27:

            certbot --nginx -n --email [email protected] --agree-tos --domains nc.domain.com

            Adding --redirect tells certbot to redirect http to https.

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

              @aaronstuder said in Install Nginx as a Reverse Proxy on Fedora 27:

              @jaredbusch said in Install Nginx as a Reverse Proxy on Fedora 27:

              certbot --nginx -n --email [email protected] --agree-tos --domains nc.domain.com

              Adding --redirect tells certbot to redirect http to https.

              I had no idea you could do this

              A 1 Reply Last reply Reply Quote 0
              • A
                Alex Sage @wirestyle22
                last edited by

                @wirestyle22 You learn something new everyday! This is what I learned 🙂

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

                  @aaronstuder Can you paste the edit to the server block? I'd like to see what it looks like after --redirect is run

                  A 1 Reply Last reply Reply Quote 0
                  • A
                    Alex Sage @wirestyle22
                    last edited by

                    @wirestyle22

                    server {
                            client_max_body_size 40M;
                            server_name domain.com;
                    
                            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://10.157.95.208:80;
                                    proxy_redirect off;
                            }
                    
                        listen 443 ssl; # managed by Certbot
                        ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # m$
                        ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; #$
                        include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
                        ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
                    
                    server {
                        if ($host = domain.com) {
                            return 301 https://$host$request_uri;
                        } # managed by Certbot
                    
                    
                            listen 80;
                            server_name domain.com;
                        return 404; # managed by Certbot
                    
                    
                    }
                    
                    
                    ObsolesceO 1 Reply Last reply Reply Quote 1
                    • ObsolesceO
                      Obsolesce @Alex Sage
                      last edited by

                      @aaronstuder Hmm, looks like mine but I didn't use the --redirect.

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        Alex Sage @Obsolesce
                        last edited by

                        @obsolesce Maybe you adding it manually?

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

                          It's standard. Only part you shouldn't have is the commented out parts.

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

                            @wirestyle22 said in Install Nginx as a Reverse Proxy on Fedora 27:

                            @JaredBusch This is from the Nginx website under pitfalls and common mistakes. I read that return's are much faster than rewrites due to not needing to evaluate RegEx(?) which is why you see return listed as a better option. I know you use rewrite and there's a lot you know that I don't so I was just wondering why that is your preference

                            0_1536070111587_Capture.PNG

                            I updated the OP to reflect this.

                            Using the return 301 https://$host$request_uri; style.

                            1 Reply Last reply Reply Quote 5
                            • brandon220B
                              brandon220
                              last edited by

                              What is a good "size" for a VM that is strictly a reverse proxy? Would 20Gb be sufficient as it is not storing any data other than log files?

                              wirestyle22W scottalanmillerS 2 Replies Last reply Reply Quote 0
                              • wirestyle22W
                                wirestyle22 @brandon220
                                last edited by wirestyle22

                                @brandon220 said in Install Nginx as a Reverse Proxy on Fedora 27:

                                What is a good "size" for a VM that is strictly a reverse proxy? Would 20Gb be sufficient as it is not storing any data other than log files?

                                Yes. 15-20 GB is enough to run with a minimal install.

                                1 Reply Last reply Reply Quote 1
                                • scottalanmillerS
                                  scottalanmiller @brandon220
                                  last edited by

                                  @brandon220 said in Install Nginx as a Reverse Proxy on Fedora 27:

                                  What is a good "size" for a VM that is strictly a reverse proxy? Would 20Gb be sufficient as it is not storing any data other than log files?

                                  Likely just fine. I use 24GB for small servers like this. And 32GB for the big ones.

                                  1 Reply Last reply Reply Quote 1
                                  • scottalanmillerS
                                    scottalanmiller
                                    last edited by

                                    I thin provision, so a little extra is no problem for me.

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

                                      @scottalanmiller Yeah, thin provisioning makes sense for something like this for sure

                                      coliverC 1 Reply Last reply Reply Quote 0
                                      • coliverC
                                        coliver @wirestyle22
                                        last edited by

                                        @wirestyle22 said in Install Nginx as a Reverse Proxy on Fedora 27:

                                        @scottalanmiller Yeah, thin provisioning makes sense for something like this for sure

                                        For almost everything thin provisioning makes sense. I'm sure there is an exception to the rule but I can't think of one off the top of my head.

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

                                          @coliver said in Install Nginx as a Reverse Proxy on Fedora 27:

                                          @wirestyle22 said in Install Nginx as a Reverse Proxy on Fedora 27:

                                          @scottalanmiller Yeah, thin provisioning makes sense for something like this for sure

                                          For almost everything thin provisioning makes sense. I'm sure there is an exception to the rule but I can't think of one off the top of my head.

                                          Databases?

                                          scottalanmillerS 1 Reply Last reply Reply Quote 0
                                          • scottalanmillerS
                                            scottalanmiller @black3dynamite
                                            last edited by

                                            @black3dynamite said in Install Nginx as a Reverse Proxy on Fedora 27:

                                            @coliver said in Install Nginx as a Reverse Proxy on Fedora 27:

                                            @wirestyle22 said in Install Nginx as a Reverse Proxy on Fedora 27:

                                            @scottalanmiller Yeah, thin provisioning makes sense for something like this for sure

                                            For almost everything thin provisioning makes sense. I'm sure there is an exception to the rule but I can't think of one off the top of my head.

                                            Databases?

                                            That would generally be it. HOWEVER, I normally put my DB on thin provisioning and have a separate, dedicated storage just for the data (DB files) which is thick provisioned.

                                            Or if on Scale, the main storage gets a low HEAT score and the dedicated DB files gets set to 11.

                                            coliverC JaredBuschJ 2 Replies Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 4 / 6
                                            • First post
                                              Last post