Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3879790
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:46:03+00:00 2026-05-19T22:46:03+00:00

I have running nginx on my server ansel.ms and a node.js app on ansel.ms:46156.

  • 0

I have running nginx on my server ansel.ms and a node.js app on ansel.ms:46156.

I want to setup nginx so it redirects everything from

ansel.ms/rhythm

to

ansel.ms:46156.


ansel.ms/rhythm/sub/path

should become

ansel.ms:46156/sub/path

This is my file in sites-available:

upstream rhythm {
    server ansel.ms:46156;
}

server {
    listen   80;
    server_name ansel.ms www.ansel.ms;
    access_log /srv/www/ansel.ms/logs/access.log;
    error_log /srv/www/ansel.ms/logs/error.log;

    location / {
        root   /srv/www/ansel.ms/public_html;
        index  index.html index.htm;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /srv/www/ansel.ms/public_html$fastcgi_script_name;
    }

    location /rhythm{
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://rhythm;
        proxy_redirect off;
    }
}

I do not really understand deeply what this does (the proxy_set_header stuff), I only copied & pasted it from several sources.

It doesn’t work.

Can you give me a hint what to change so it does what I described above?
Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:46:03+00:00Added an answer on May 19, 2026 at 10:46 pm

    I cannot spot the error in your configuration file; I’m an nginx-newbie as well.

    But here is my full nginx.conf config file which redirects http://myhost/cabaret/foo/bar to http://myhost:8085/foo/bar:

    user www-data;
    worker_processes  1;
    error_log  /var/log/nginx/error.log;
    pid        /var/run/nginx.pid;
    
    events {
        worker_connections  1024;
    }
    
    http {
        include     /etc/nginx/mime.types;
        access_log  /var/log/nginx/access.log;
        sendfile        on;
        keepalive_timeout  65;
        tcp_nodelay        on;
    
        server {
    
            listen   *:80; ## listen for ipv4
            access_log  /var/log/nginx/localhost.access.log;
            location /cabaret {
                   rewrite /cabaret(.*) $1 break;
                   proxy_pass http://127.0.0.1:8085;
                   proxy_redirect     off;
                   proxy_set_header   Host             $host;
                   proxy_set_header   X-Real-IP        $remote_addr;
                   proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            }
        }
    }
    

    It is not perfect, because it will not work with http://myhost/cabaret, only if a slash follows carabet like in http://myhost/cabaret/ or http://myhost/cabaret/foo/bar.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two websites running on my own root server (ubuntu/nginx/php-fpm). Now I want
I have GIT running on a Solaris server. From a windows machine I installed
I have an ubuntu server running nginx. I just tried to enable a vhost
I have a server running nginx + UWSGI + python. UWSGI is running as
I have a Rails 3.1 app running in production using Nginx and Unicorn. And
I have a Express.js (v 2.5.8) (node v0.6.12) server running on port 3100. It
I have NGINX running on port 8080. I have the following setup in my
I have a setup such that an nginx server passes control off to uWsgi,
I have an NGINX server with fastcgi/PHP running on it. I need to add
I have a nginx server running with ssl enabled. Currently I have https enabled

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.