Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set up a Reverse proxy on my VPS for my Heroku app ( So if I visit I can get the content in

I followed the instructions on the Apache wiki.

    location /couchdb {
        rewrite /couchdb/(.*) /$1 break;
        proxy_pass http://localhost:5984;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

I changed it to fit my situation:

    location /blog {
        rewrite /blog/(.*) /$1 break;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

When I visit, the page show up, but js/css file cannot be gotten (404).
Their link becomes but not

What's wrong and how can I fix it?

share|improve this question

You need to fix the references in your HTML, nginx isn't responsible for doing it for you. You can set them to be agnostic to what directory they reside in:

<link rel="stylesheet" type="text/css" href="style.css">

(instead of "/style.css")

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.