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

  • Home
  • SEARCH
  • 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 6782567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:45:29+00:00 2026-05-26T16:45:29+00:00

I recently set up a Nginx server to host a wordpress install and am

  • 0

I recently set up a Nginx server to host a wordpress install and am using Varnish as a reverse proxy in front of the server. Varnish is running on port 80, so I have set up Nginx to listen to 80 and redirect. Unfortunately on redirection, the port 8080 is appended to the nginx request.

Including port_in_redirect off seems to be the general solution to this problem, but it doesn’t appear to be working for me. I’ve attached the /sites-enabled/default config below. Am I doing anything wrong?! The php redirections seems to work fine, it’s only at location /where it fails.

/sites-enabled/default:

server { 
    listen 8080 default;
    server_name "" xxx.xxx.xxx.xxx;  #just using IP here (no domain yet)

    port_in_redirect off;
    server_name_in_redirect off;

    access_log  /var/log/nginx/localhost.access.log;


    location / {
            root   /var/www/site/html/;
            index  index index.php;
            try_files $uri/ $uri /index.php?q=$uri&$args;
    }

    location ~ .php$ {
            fastcgi_split_path_info ^(.+.php)(.*)$;
            fastcgi_pass   backend;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/site/html/$fastcgi_script_name;
            include fastcgi_params;
            fastcgi_param  QUERY_STRING     $query_string;
            fastcgi_param  REQUEST_METHOD   $request_method;
            fastcgi_param  CONTENT_TYPE     $content_type;
            fastcgi_param  CONTENT_LENGTH   $content_length;
            fastcgi_intercept_errors        on;
            fastcgi_ignore_client_abort     off;
            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            fastcgi_read_timeout 180;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 4 256k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
            fastcgi_param SERVER_PORT 80;
    }

    location ~ /.ht {
        deny  all;
    }
    location ~ /.git {
        deny  all;
    }
    location ~ /.svn {
        deny  all;
    }

}

upstream backend {
    server 127.0.0.1:9000;
}

nginx.conf:

user www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log debug;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
    multi_accept on; 
}

http {
    include       /etc/nginx/mime.types;

    access_log  /var/log/nginx/access.log;

    sendfile        on;
    tcp_nopush     off;

    keepalive_timeout  30;
    tcp_nodelay        on;

    gzip  on;
    gzip_proxied any;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";
    gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}

nginx: nginx version: nginx/1.0.9

  • 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-26T16:45:30+00:00Added an answer on May 26, 2026 at 4:45 pm

    Actually, just sorted it. Simple error – in the WordPress admin site wp-admin > Settings > WordPress address (URL) and Site address (URL) both had the port 8080 in the URL! Hence the redirection. The above setup works fine like this.

    If that doesn’t solve your problem a one tip I learned was to add print_r($_SERVER["SERVER_PORT"]); in your index.php to ensure you are getting the correct port (80 in my case) set from fastcgi.

    Hopefully this simple step can save someone some time!

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

Sidebar

Related Questions

I have recently set up a website using MODx Revolution. I am attempting to
At my company we have recently set up a TeamFoundation proxy to our TeamFoundationServer.
I heard recently that Nginx has added caching to its reverse proxy feature. I
Im using ISPConfig 3.0.4 With multiple sites running on it already. I have recently
I recently set up a local copy of Wordpress, added some content and created
I've recently set up a WordPress blog and it's removing the www from all
I recently discovered that when you have a page set to session readonly and
I've recently set up a Ubuntu 9.10 server with a LAMP configuration and then
I've recently set up cygwin, git, and gitosis on my Windows Server 2003 box
I've recently set some coursework for some undergraduate students for which they have to

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.