Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Currently my blog is hosted at and is hosted on a LAMP stack and running wordpress. This is where I have the DNS a record point to.

I also have hosted on an nginx server and is going to run my ecommerce app (magento). The dns a record points here. We put both applications on sepparate servers for security reasons.

I wanted to move the blog to for seo reasons. What I did was set up a reverse proxy with nginx as a frontend cache for the apache/wordpress backend. So this is working beautifully and I have noticed the caching is really improving my load times.

Now I need to redirect all my requests to But what is the best approach? Should I change the dns a record for to my nginx server and then have nginx process the rewrite/redirect? Or should I put the rewrite on the apache server? I only have access the the .htaccess file on the Apache server.

I haven't ever done this so I thought I'd ask the community what is the best approach for situations like this.


share|improve this question
I think it would be good practise to have the A record point to the right server. Then rewrite the blog URL, or just proxy the blog URL to the real url of the blog. That way the url does not change for your users. –  Isaac Feb 5 '13 at 17:22
So you are saying keep the a record for pointed to the LAMP stack server that actually runs wordpress? Then to do an internal rewrite on that server for any requests to, which then actually bounces back to Nginx since it is hosting, and then finally it will reverse proxy the request to the LAMP wordpress server that runs and display the content? Thanks for the help! Just wanna make sure I understand. –  thindery Feb 5 '13 at 21:09
Ok, I think I missunderstood your question. If your nginx, which serves your magento, is also a reverse proxy for your LAMP Server, then the A record should point there. Because from the outside, your site "lives" there, its not relevant that its just a proxy. –  Isaac Feb 6 '13 at 7:34
Thanks for the clarification. That makes sense. –  thindery Feb 6 '13 at 14:25

1 Answer 1

You have two options:

Option 1: Keep the DNS as is.

  • Setup a redirect on Apache.
  • Make sure to exclude your reverse proxy so it doesnt get redirected to itself.
  • Advantage is that this is less effort.

Option 2: Move stuff around.

  • Create an additional A record, say pointing to the server actually hosting the blog (Apache)
  • Change the reverse proxy settings to point to
  • Configure Nginx on to handle and redirect it to
  • Change the DNS for so it points to the same server as (Nginx)
  • Change firewall on blog-backend (apache) so it only accepts requests from Nginx.
  • Still need to keep the blog-backend server, so the blog will be isolated from the e-commerce site.
  • More effort, no real payoff
share|improve this answer

Your Answer


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.