# Problem with updated nginx

**URL:** <https://www.ruby-forum.com/t/problem-with-updated-nginx/211191>\
**Category:** NGINX\
**Created:** [August 28, 2011, 11:49pm UTC](https://www.ruby-forum.com/t/problem-with-updated-nginx/211191 "2011-08-28T23:49:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 28, 2011, 11:49pm UTC](https://www.ruby-forum.com/t/problem-with-updated-nginx/211191/1 "2011-08-28T23:49:04Z")

</div>

Hi All,

I have run nginx on OpenBSD for several years without problems. Recently  
I upgraded to a new OpenBSD and with that to a new nginx. I went from  
nginx 0.7.64 to 0.8.53p5  
nginx still works but I ran into a problem: nginx listens on  
localhost:10080. I use firewall rules to get my traffic there. For some  
reason 0.8.53 sometimes adds the portnumber to an URL resulting in error  
messages. I found a work around but that is not an acceptable final  
solution as it is very difficult to update everything and the problem  
will likely re-appear in the future.

The details:  
nginx.conf:  
…  
server {  
listen localhost:10080;  
server\_name [www.example.com:80](http://www.example.com:80);

location ^~ /pfstat {  
root /var/mine/data;  
index index.html index.htm index.php;  
autoindex on;  
}  
…  
}  
…

If a html file on the server contains I get a message  
that the connection to nginx was denied and the URL displayed in the  
browser is changed into something like [www.example.com:10080/pfstat](http://www.example.com:10080/pfstat) (the  
port on which nginx listens is added). If the html file on the server  
contains (additional ‘/’ at the end) everything works  
OK (the 10080 is NOT added to the URL). This problem only exists when  
referring to a directory, references to a file work normally ().

 

Can anybody shed some light on this.  
Has anything been changed in this area?

 

Regards,  
Paul

 

Ps: It is not an option to update all html files to include a trailing  
‘/’ in case of references to a folder. This is not only a lot of work it  
probably also involves modifying other peoples pages.

 

Posted at Nginx Forum:

> **[Problem with updated nginx](https://forum.nginx.org/read.php?2,214407,214407#msg-214407)**
>
> Hi All, I have run nginx on OpenBSD for several years without problems. Recently I upgraded to a new OpenBSD and with that to a new nginx. I went from nginx 0.7.64 to 0.8.53p5 nginx still works but I ran into a problem: nginx listens on...

---

<div class="post-metadata">

**Author:** ![pvsw1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pvsw1](https://www.ruby-forum.com/u/pvsw1)\
**Post date:** [August 29, 2011, 2:46am UTC](https://www.ruby-forum.com/t/problem-with-updated-nginx/211191/2 "2011-08-29T02:46:23Z")

</div>

Hello!

On Sun, Aug 28, 2011 at 05:48:46PM -0400, pvsw1 wrote:

> will likely re-appear in the future.  
> index index.html index.htm index.php;  
> contains (additional ‘/’ at the end) everything works  
> OK (the 10080 is NOT added to the URL). This problem only exists when  
> referring to a directory, references to a file work normally ().
> 
>  
> 
> Can anybody shed some light on this.  
> Has anything been changed in this area?

 

Short answer:

 

port\_in\_redirect off;

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

Long answer:

Most likely it worked for you previously since you have  
“www.example.com:80” (note “:80”) in “server\_name” directive.  
This is meaningless (it will never match), but resulting redirects  
in 0.7.64 should look like

```
Location: http://www.example.com:80:10080/pfstat/

```

Since 0.8.48 directive “server\_name\_in\_redirect” defaults to off,  
and hostname from client’s request will be used instead, without  
any “:80”. As a result will no longer have “:80” in them, likely  
breaking things for you.

Correct aproach in both versions is to use

```
port_in_redirect off;

```

as shown above in short answer.

Maxim D.

---

<div class="post-metadata">

**Author:** ![pvsw1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac8455/32.png) [@pvsw1](https://www.ruby-forum.com/u/pvsw1)\
**Post date:** [September 7, 2011, 10:57pm UTC](https://www.ruby-forum.com/t/problem-with-updated-nginx/211191/3 "2011-09-07T22:57:09Z")

</div>

Hi Maxim,

Thanks for the reply. That fixed my problem

Regards,  
Paul

Posted at Nginx Forum:

> **[Re: Problem with updated nginx](https://forum.nginx.org/read.php?2,214407,214958#msg-214958)**
>
> Hi All, I have run nginx on OpenBSD for several years without problems. Recently I upgraded to a new OpenBSD and with that to a new nginx. I went from nginx 0.7.64 to 0.8.53p5 nginx still works but I ran into a problem: nginx listens on...
