Redirect to 'www' prefix domain using nginxRedirect 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

How can I deal with my CEO asking me to hire someone with a higher salary than me, a co-founder?

Why do bosons tend to occupy the same state?

How do conventional missiles fly?

ssTTsSTtRrriinInnnnNNNIiinngg

Forgetting the musical notes while performing in concert

Alternative to sending password over mail?

Assassin's bullet with mercury

Can a virus destroy the BIOS of a modern computer?

Watching something be piped to a file live with tail

Avoiding direct proof while writing proof by induction

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

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

What reasons are there for a Capitalist to oppose a 100% inheritance tax?

GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?

Mathematica command that allows it to read my intentions

Is there an expression that means doing something right before you will need it rather than doing it in case you might need it?

One verb to replace 'be a member of' a club

Why doesn't using multiple commands with a || or && conditional work?

How would I stat a creature to be immune to everything but the Magic Missile spell? (just for fun)

Avoiding the "not like other girls" trope?

What are some good books on Machine Learning and AI like Krugman, Wells and Graddy's "Essentials of Economics"

Ambiguity in the definition of entropy

What is a romance in Latin?

Should I cover my bicycle overnight while bikepacking?



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 8 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

          Möglingen Índice Localización Historia Demografía Referencias Enlaces externos Menú de navegación48°53′18″N 9°07′45″E / 48.888333333333, 9.129166666666748°53′18″N 9°07′45″E / 48.888333333333, 9.1291666666667Sitio web oficial Mapa de Möglingen«Gemeinden in Deutschland nach Fläche, Bevölkerung und Postleitzahl am 30.09.2016»Möglingen

          Virtualbox - Configuration error: Querying “UUID” failed (VERR_CFGM_VALUE_NOT_FOUND)“VERR_SUPLIB_WORLD_WRITABLE” error when trying to installing OS in virtualboxVirtual Box Kernel errorFailed to open a seesion for the virtual machineFailed to open a session for the virtual machineUbuntu 14.04 LTS Virtualbox errorcan't use VM VirtualBoxusing virtualboxI can't run Linux-64 Bit on VirtualBoxUnable to insert the virtual optical disk (VBoxguestaddition) in virtual machine for ubuntu server in win 10VirtuaBox in Ubuntu 18.04 Issues with Win10.ISO Installation

          Antonio De Lisio Carrera Referencias Menú de navegación«Caracas: evolución relacional multipleja»«Cuando los gobiernos subestiman a las localidades: L a Iniciativa para la Integración de la Infraestructura Regional Suramericana (IIRSA) en la frontera Colombo-Venezolana»«Maestría en Planificación Integral del Ambiente»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»«Conózcanos»«Caracas: evolución relacional multipleja»«La Metrópoli Caraqueña: Expansión Simplificadora o Articulación Diversificante»