I have a server on which I have configured Nginx and Unicorn, where Unicorn servers static pages. In my case I'm writing a rewrite rule in Nginx that, if a request comes to mydomain.com it should redirect to another domain, which is possible with following rule.

location / {
rewrite ^/$ yahoo.com;

Well, the above code is working fine for me, but when I write mydomain.com/docs/web in the address bar, Nginx throws 404 page. Basically, in my case Unicorn handles this request (when above Nginx code does not exist), and I want it so that Unicorn should handle this request when the above code exists in Nginx.

  • location = / instead of location / – frostschutz Jun 19 '13 at 23:31
  • yeah! tried with the same, but no luck. – Nitesh B. Jun 20 '13 at 1:54
  • What does the rest of your nginx config look like? – Micah Feb 3 '14 at 20:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.