Wednesday, October 28, 2015

Redirect rules for nginx server block

If you want server_name without www then follow this
server {
 listen 80 default_server;
 server_name subdomain.domain.com;
 passenger_enabled on;
 passenger_app_env production;
 root /home/sachin/testapp/public;
}
server {
listen 80;
server_name www.subdomain.domain.com;
return 301 $scheme://subdomain.domain.com$request_uri;
}
If you want server_name with www then follow this
server {
 listen 80 default_server;
 server_name www.subdomain.domain.com;
 passenger_enabled on;
 passenger_app_env production;
 root /home/sachin/testapp/public;
}
server {
 listen 80;
 server_name www.subdomain.domain.com;
 return 301 $scheme://www.subdomain.domain.com$request_uri;
Ref. taken from here. 

42 comments:

  1. You have posted such a good post. I am very impressed by your work towards your post for sharing such useful information. Thank you.domain name

    ReplyDelete
  2. This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks Best find discord servers service provider.

    ReplyDelete
  3. Wow! Thank you! I constantly wanted to write on my site something like that. Can I take a portion of your post to my website? best woocommerce development company service provider.

    ReplyDelete
  4. Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. Best web design and development company service provider.

    ReplyDelete
  5. I generally check this kind of article and I found your article which is related to my interest. Genuinely, it is good and instructive information about Shopify Competitors and AlternativesThanks for sharing an amazing article here.

    ReplyDelete
  6. Wow! Thank you! I constantly wanted to write on my site something like that. Can I take a portion of your post to my website? Best small business it support services near me service provider.

    ReplyDelete
  7. Great article by the great author, it is very massive and informative but still preaches the way to sounds like that it has some beautiful thoughts described so I really appreciate this article. Best latest govt jobs in pakistan service provider.

    ReplyDelete
  8. You have done good work by publishing this article here. I found this article too much informative, and also it is beneficial to enhance our knowledge. Grateful to you for sharing an article like this. domain name malaysia

    ReplyDelete
  9. Excellent information, this knowledge is excellent and very important for everyone. I am heartily thankful to you for providing this kind of information. Thanks once again for sharing it. website design seattle

    ReplyDelete
  10. Great article by the great author, it is very massive and informative but still preaches the way to sounds like that it has some beautiful thoughts described so I really appreciate this article. Best it services for small business service provider

    ReplyDelete
  11. This is really a good source of information, I will often follow it to know more information and expand my knowledge, I think everyone should know it, thanks Get for more information https://www.heroxhost.com/

    ReplyDelete
  12. Unison relocation packers and movers -hyderabad is one of the top most packers movers service providers in hyderabad. we provide our services in residential and commercial areas in hyderabad.packers and movers Hyderabad


    ReplyDelete
  13. I loved your suggestion and information.Your blog is knowledgable Ecommerce Website Design Services .Thanks for sharing this blog.

    ReplyDelete
  14. Unison relocation packers and movers -hyderabad is one of the top most packers movers service providers in hyderabad. we provide our services in residential and commercial areas in hyderabad.
    packers movers

    ReplyDelete
  15. Heroxhost is best domain provider in india & cheap domain hosting offers Hosting Services Company in India. fastest web hosting india, Linux cPanel Reseller Hosting.
    linux hosting

    ReplyDelete
  16. I examine your blog site presently share great information right below. Telstra Dealers

    ReplyDelete
  17. I found decent information in your article.business voip phone service I am impressed with how nicely you described this subject, It is a gainful article for us. Thanks for share it.

    ReplyDelete
  18. Unison relocation packers and movers -hyderabad is one of the top most packers movers service providers in hyderabad. we provide our services in residential and commercial areas in hyderabad.

    Unison Relocation Packers and Movers Hyderabad
    Unison Relocation
    Relocation in Hyderabad
    Hyderabad Relocation
    packers and movers
    packers and movers Hyderabad
    packers movers
    movers
    house moving service
    home movers and packers

    ReplyDelete
  19. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.

    digital marketing services in delhi

    ReplyDelete
  20. Very good, This information is essential and informative which you have shared here. Read more info about VPS Hosting Plans In USA. It is beneficial for beginners to develop their knowledge. It is very gainful information. Thanks for share it.

    ReplyDelete
  21. Enjoy reading the article above, it really explains everything in detail about Graphic Design Services, the article is very interesting and effective. Thank you and good luck with the upcoming article

    ReplyDelete
  22. Thanks for sharing the best information and suggestions, it is very nice and very useful to us. I appreciate the work that you have shared in this post. Keep sharing these types of articles here.Free Domain Registration Nigeria

    ReplyDelete
  23. This post is really awesome. Genuinely i like this blog. It gives me more useful information. I hope you share lots of things with us .Digital communications in Mexico

    ReplyDelete
  24. Excellent job, this is great information which is shared by you. This info is meaningful and factual for us to increase our knowledge about it. about Website Reseller Hosting So please always keep sharing this type of information.

    ReplyDelete
  25. I read all the information you have mentioned in your blog that is really commendable. I really like your post, please share more information with us. best android app development company

    ReplyDelete
  26. You have a genuine capacity to compose a substance that is useful for us. You have shared an amazing post about web development company abu dhabi thanks for sharing.

    ReplyDelete
  27. I generally check this kind of blog and I found your blog which is related to my interest. Genuinely, it is good and instructive information about Web Design Company Thanks for sharing an amazing blog here.

    ReplyDelete
  28. I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.san antonio website design site.

    ReplyDelete
  29. You've posted a very informative post here. This article provided me with some useful knowledge. Thank you for sharing that. Keep up the good work.

    ReplyDelete
  30. I examine your blog site presently share great information right below. softphone

    ReplyDelete
  31. Great job for publishing such a nice article. Your article isn’t only useful but it is additionally really informative. Thank you because you have been willing to share information with us.Smtp Server For Bulk Email

    ReplyDelete
  32. Excellent information, Thanks for publishing such essential information. You are doing such a good job. This information is very helpful for everyone. Keep it up. Thanks. Offshore Web Host

    ReplyDelete
  33. Excellent information, Thanks for publishing such essential information. You are doing such a good job. This information is very helpful for everyone. Keep it up. Thanks. web development company in united states

    ReplyDelete
  34. You've created an excellent essay. Your essay gave me some unique and useful information. Thank you for bringing this article to our attention. Web design company San Antonio TX

    ReplyDelete
  35. A very delightful article that you have shared here.1 dollar hosting cpanel Your blog is a valuable and engaging article for us, and also I will share it with my companions who need this info. Thankful to you for sharing an article like this.

    ReplyDelete
  36. This comment has been removed by the author.

    ReplyDelete
  37. Valuable information. Thanks for publishing such great information. We provides variety of offshore hosting & Offshore Dedicated Servers, Here at WebCare360, the security of our clients is our top priority.

    ReplyDelete
  38. This blog is really helpful to deliver updated affairs over internet which is really appraisable.
    Fortinet support

    ReplyDelete
  39. I found one successful example of this truth through this blog. I am going to use such information now. JPloft solutions

    ReplyDelete
  40. Your foreign SIM card comes in two distinct varieties depending on how often you want to use it. Some are more expensive to buy upfront but at lower rates, and others are less expensive but higher. IoT SIM Card

    ReplyDelete
  41. You've provided quite good information here. This is fantastic since it expands our knowledge and is also beneficial to us about Managed IT Services in Melbourne. Thank you for sharing this piece of writing.

    ReplyDelete