Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I had just set up nginx on my server. I have PHP and everything working okay. Except when I try the URL

http://xxx.xxx.xxx.xxx/123

I get redirected to

http://_/123

but when I try the url

http://xxx.xxx.xxx.xxx/123/

It works just as I want it to. How can I get nginx to treat the slashless url decently?

share|improve this question
add comment

2 Answers

Check your php. I had similar problem when I had redirect($_SERVER['SERVER_NAME']) in my login.php. I replaced it with redirect($_SERVER['HTTP_HOST']) and now everything is fine. $_SERVER['SERVER_NAME'] is the first domain in server_name directive in nginx and $_SERVER['HTTP_HOST'] is domain in request.

share|improve this answer
add comment

Try this in your config:

server_name_in_redirect off;

See the relevant docs here:

http://wiki.nginx.org/HttpCoreModule#server_name_in_redirect

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.