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 9000459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:18:50+00:00 2026-06-16T00:18:50+00:00

I have an nginx server processing PHP requests, but it’s configured to listen on

  • 0

I have an nginx server processing PHP requests, but it’s configured to listen on a non-standard port (port 12345 or something). I can’t change the listen port because corporate IT says, “No.”

There is a proxy in the data center that forwards requests from http://www.domain.com:80 to the nginx box on port 12345.

I have some static 301 redirects that I need to put in place, but I’m getting unexpected behavior.

Sample redirects in site.conf “server { }” block:

rewrite ^/foo$ /bar/foo/ permanent;

When I attempt to go to http://www.domain.com/foo, the redirect happens, but it tries to forward the browser to http://www.domain.com:12345/bar/foo/

My question is, how can I get nginx to redirect the user to the correct port (www.domain.com/bar/foo/)?

Maybe a better question is, what is the correct way to do what I’m asking? There are 50+ redirects that need to go in, and I’d rather not create a “location” section for each of those redirects.

  • 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-06-16T00:18:51+00:00Added an answer on June 16, 2026 at 12:18 am

    You can provide a more explicit rewrite. Try the following:

    rewrite ^/foo/ $scheme://www.domain.com:80/bar$request_uri permanent;
    

    I have assumed that you meant to use ^/foo/ instead of ^/foo$, since ^/foo$ is a very specific case. Just revise as needed.

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

Sidebar

Related Questions

I have this nginx vhost file server { # php/fastcgi listen 80; server_name trinityplex.com
I have this configuration of nginx : server { listen 80; server_name example.com www.example.com;
I have two websites running on my own root server (ubuntu/nginx/php-fpm). Now I want
I have Nginx as my front-end web server listening on port 80. And certain
I have an Nginx HTTP server with PHP-FPM set up and almost everything works
I am setting up an infrastructure where I have an nginx web server configured
I have nginx configured to proxy https traffic to an http server running on
I have an NGINX server with fastcgi/PHP running on it. I need to add
I have a nginx server with work with php by fast cgi. when I
So I have a NGINX server listening on port 8080 with uwsgi on Vagrant

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.