Redirect to 'www' prefix domain using nginxRedirect to https with www for particulate domain on HAproxyHow do...

Alternative to sending password over mail?

Why can't we play rap on piano?

Size of subfigure fitting its content (tikzpicture)

Why do bosons tend to occupy the same state?

Little known, relatively unlikely, but scientifically plausible, apocalyptic (or near apocalyptic) events

Why would the Red Woman birth a shadow if she worshipped the Lord of the Light?

What's the in-universe reasoning behind sorcerers needing material components?

Why no variance term in Bayesian logistic regression?

How can saying a song's name be a copyright violation?

ssTTsSTtRrriinInnnnNNNIiinngg

How do I gain back my faith in my PhD degree?

Why didn't Boeing produce its own regional jet?

Can I run a new neutral wire to repair a broken circuit?

Am I breaking OOP practice with this architecture?

How dangerous is XSS?

iPad being using in wall mount battery swollen

How seriously should I take size and weight limits of hand luggage?

Personal Teleportation: From Rags to Riches

Can we compute the area of a quadrilateral with one right angle when we only know the lengths of any three sides?

How does a predictive coding aid in lossless compression?

Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?

Is it inappropriate for a student to attend their mentor's dissertation defense?

How to tell a function to use the default argument values?

Could the museum Saturn V's be refitted for one more flight?



Redirect to 'www' prefix domain using nginx


Redirect to https with www for particulate domain on HAproxyHow do I redirect different apps into a single domain with Nginx Ubuntu 16Redirect all remaining pages using location blockCan anybody detect file in directory www (nginx)?Getting 404 error in Ubuntu//nginx using IP addressCan't redirect HTTP to HTTPS on NGINXNginx failing to redirect to docker containerRuby on Rails - 403 Forbidden - Ownership / Permissions - DocumentRoot doesn't exist - Denied by Server Configurationnginx expose port and not redirectNGINX - Change request_method & redirect













0















I brought a domain in godady and I have Installed Passenger + Nginx on a Linux/Unix(Ubuntu) server and deployed a Ruby app. Now my domain looks something like http://example.com when I try to request from a browser.
But I want my domain to default redirect to www every time it is requested from a browser(like http://www.example.com.).



example.conf



    server {
listen 80;
server_name www.example.com example.com;
# return 301 $scheme://www.example.com$request_uri;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/example/public;

# Turn on Passenger
passenger_enabled on;
passenger_spawn_method direct;
passenger_min_instances 1;
#passenger_pool_idle_time 0;
rails_env development;
passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
passenger_sticky_sessions on;


}


uncommenting the line




return 301 $scheme://www.example.com$request_uri;




is throwing the error



www.example.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS


I am forced to manually type www.example.com in the browser. Instead, how can I redirect to www by default?



Any Help is highly appreciated. Thanks in advance!









share



























    0















    I brought a domain in godady and I have Installed Passenger + Nginx on a Linux/Unix(Ubuntu) server and deployed a Ruby app. Now my domain looks something like http://example.com when I try to request from a browser.
    But I want my domain to default redirect to www every time it is requested from a browser(like http://www.example.com.).



    example.conf



        server {
    listen 80;
    server_name www.example.com example.com;
    # return 301 $scheme://www.example.com$request_uri;
    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/example/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_spawn_method direct;
    passenger_min_instances 1;
    #passenger_pool_idle_time 0;
    rails_env development;
    passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
    passenger_sticky_sessions on;


    }


    uncommenting the line




    return 301 $scheme://www.example.com$request_uri;




    is throwing the error



    www.example.com redirected you too many times.
    Try clearing your cookies.
    ERR_TOO_MANY_REDIRECTS


    I am forced to manually type www.example.com in the browser. Instead, how can I redirect to www by default?



    Any Help is highly appreciated. Thanks in advance!









    share

























      0












      0








      0








      I brought a domain in godady and I have Installed Passenger + Nginx on a Linux/Unix(Ubuntu) server and deployed a Ruby app. Now my domain looks something like http://example.com when I try to request from a browser.
      But I want my domain to default redirect to www every time it is requested from a browser(like http://www.example.com.).



      example.conf



          server {
      listen 80;
      server_name www.example.com example.com;
      # return 301 $scheme://www.example.com$request_uri;
      # Tell Nginx and Passenger where your app's 'public' directory is
      root /var/www/example/public;

      # Turn on Passenger
      passenger_enabled on;
      passenger_spawn_method direct;
      passenger_min_instances 1;
      #passenger_pool_idle_time 0;
      rails_env development;
      passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
      passenger_sticky_sessions on;


      }


      uncommenting the line




      return 301 $scheme://www.example.com$request_uri;




      is throwing the error



      www.example.com redirected you too many times.
      Try clearing your cookies.
      ERR_TOO_MANY_REDIRECTS


      I am forced to manually type www.example.com in the browser. Instead, how can I redirect to www by default?



      Any Help is highly appreciated. Thanks in advance!









      share














      I brought a domain in godady and I have Installed Passenger + Nginx on a Linux/Unix(Ubuntu) server and deployed a Ruby app. Now my domain looks something like http://example.com when I try to request from a browser.
      But I want my domain to default redirect to www every time it is requested from a browser(like http://www.example.com.).



      example.conf



          server {
      listen 80;
      server_name www.example.com example.com;
      # return 301 $scheme://www.example.com$request_uri;
      # Tell Nginx and Passenger where your app's 'public' directory is
      root /var/www/example/public;

      # Turn on Passenger
      passenger_enabled on;
      passenger_spawn_method direct;
      passenger_min_instances 1;
      #passenger_pool_idle_time 0;
      rails_env development;
      passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
      passenger_sticky_sessions on;


      }


      uncommenting the line




      return 301 $scheme://www.example.com$request_uri;




      is throwing the error



      www.example.com redirected you too many times.
      Try clearing your cookies.
      ERR_TOO_MANY_REDIRECTS


      I am forced to manually type www.example.com in the browser. Instead, how can I redirect to www by default?



      Any Help is highly appreciated. Thanks in advance!







      server dns nginx ruby





      share












      share










      share



      share










      asked 3 mins ago









      current_usercurrent_user

      1055




      1055






















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131082%2fredirect-to-www-prefix-domain-using-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1131082%2fredirect-to-www-prefix-domain-using-nginx%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...