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

I'm trying to setup a proxy server using nginx. The server is running Windows Server 2003 and running IIS and tomcat. What I'm trying to achieve is to redirect call say from sma.local.com:80 to the internal server that is on servername.domain.com:8080/orderpad.

This is my first time dealing with nginx and I'm a bit frustrated with it. NGINX config

server {
    listen       80;
    server_name  sma.local.com;

    access_log  logs/host.access.log  main;

    location / {
        proxy_pass sservername.domain.com:8080/orderpad;
        #proxy_set_header   Host    servername.domain.com:8080/orderpad;
        #proxy_set_header   X-Host  servername.domain.com:8080/orderpad;
        #proxy_set_header   X-Real-IP             $remote_addr;
        #proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;

I'm getting a 404 error when trying to access the sma.local.com address.

share|improve this question

migrated from stackoverflow.com Jul 21 '09 at 2:41

This question came from our site for professional and enthusiast programmers.

Belongs to ServerFault. –  LiraNuna Jul 21 '09 at 1:32

2 Answers 2

You can be redirected to your upstream server like this :

http {
    upstream myserver {

     server {
         listen 80;
         server_name sma.local.com;

         access_log logs/host.access.log main;

    location / {
        proxy_pass http://myserver/orderpad;

share|improve this answer

don't you have to have the full "http://..." URI in your proxy pass?

Example: Nginx LoadBalance Example

EDIT: Oh and if you wanted URIs such as /orderpad/testthing, then you need the trailing slash '/' otherwise it'll end up as /orderpadtestthing

share|improve this answer

Your Answer


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