Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two domain's set up on my server. Domain 1 is configured with google apps so that mail.domain1.com goes to google's mail. However, I would like domain1.com to redirect to domain2.com.

Currently in my nginx.conf file

I had

server {
    listen 80;
    server_name domain2.com .domain1.com;
    rewrite ^/(.*) http://domain2.com permanent;
    root /home/demo/apps/cjl/public;
    passenger_enabled on;
    rails_spawn_method smart;
 }

When I did this Firefox popped up a "Redirect not configured correctly" error and said that it thought that the redirect would create a never ending loop.

I'm wondering how to set this up and any help would be appreciated. Thank you!

share|improve this question

1 Answer 1

up vote 0 down vote accepted

make another server {} for domain2.com.

The loop is happening due to the redirect being happening on both server_name's

share|improve this answer

Your Answer

 
discard

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