# Strange proxy\_pass problem

**URL:** <https://www.ruby-forum.com/t/strange-proxy-pass-problem/237012>\
**Category:** NGINX\
**Created:** [October 18, 2013, 5:35pm UTC](https://www.ruby-forum.com/t/strange-proxy-pass-problem/237012 "2013-10-18T17:35:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [October 18, 2013, 5:35pm UTC](https://www.ruby-forum.com/t/strange-proxy-pass-problem/237012/1 "2013-10-18T17:35:02Z")

</div>

Hi,

I recently upgraded a server from nginx 1.2.8 to 1.4.3 (on FreeBSD  
amd64).

nginx is a reverse-proxy to apache, intended to serve static files  
directly and pass all php requests zu apache - with one exception: the  
default vhost on both nginx and apache.

It looks like this (on apache):

Alias /phpmyadmin “/usr/local/www/phpMyAdmin/”

FastCgiExternalServer /home/www/fastcgi/www.server -socket www.sock  
-flush -idle-timeout 120 Alias /php.fcgi /home/www/fastcgi/www.server

\<Directory “/usr/local/www/phpMyAdmin”\>  
AllowOverride None  
Options FollowSymLinks  
Order allow,deny  
Allow from all

(php is chrooted with php-fpm)

and then there’s a “normal” vhost like this:

\<VirtualHost \*:8080\>  
ServerAdmin rdudemotest2@bla  
ServerName rdudemotest2.bla  
DocumentRoot /home/rdudemotest2/FTPROOT/htdocs/  
CustomLog /home/rdudemotest2/logs/nginx\_access\_log combined  
ErrorLog /home/rduedmotest2/logs/error\_log  
\<Directory /home/rdudemotest2/FTPROOT/htdocs/\>  
AllowOverride All  
  
FastCgiExternalServer /home/www/fastcgi/rdudemotest2.server -socket  
rdudemotest2.sock  
Alias /php.fcgi /home//www/fastcgi/rdudemotest2.server

For nginx, I have in nginx.conf:

```
upstream apache8080 {
  server 127.0.0.1:8080;
  keepalive 16;
  }

```

and then a default vhost like this:

server {  
listen 80 default\_server;  
access\_log /home/nginx/logs/default-access\_log;  
error\_log /home/nginx/logs/default-error\_log ;  
location / {  
include proxy.conf ;  
proxy\_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);  
}  
location /phpmyadmin/ {  
include proxy.conf ;  
proxy\_pass [http://127.0.0.1:8080](http://127.0.0.1:8080);  
}  
location /nginx\_status {  
stub\_status on;  
access\_log off;  
allow 127.0.0.1;  
deny all;  
}  
}

and the vhost from above:

server {  
listen our.ip;  
server\_name rdudemotest2.bla ;  
access\_log /home/rdudemotest2/logs/nginx\_access\_log;  
error\_log /home/rdudemotest2/logs/nginx\_error\_log;  
root /home/rdudemotest2/FTPROOT/htdocs;  
location ~\*  
^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|woff|mp3)$  
{ expires 24h; }  
location / {  
include proxy.conf;  
proxy\_pass [http://apache8080](http://apache8080);  
}  
}

Now, the problem is that while I can in principle access phpmyadmin,  
(via [http://our.ip/phpmyadmin/](http://our.ip/phpmyadmin/) - I can login, databases are displayed  
etc.) the images aren’t found anymore, because the requests for the  
images end up at the non-default vhost rdudemotest2.

I haven’t checked for a while, but I’m pretty sure this worked  
previously.

Can anyone shed some light on this?

---

<div class="post-metadata">

**Author:** ![Rainer\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/839c29/32.png) [@Rainer\_D](https://www.ruby-forum.com/u/Rainer_D)\
**Post date:** [October 18, 2013, 6:51pm UTC](https://www.ruby-forum.com/t/strange-proxy-pass-problem/237012/2 "2013-10-18T18:51:00Z")

</div>

On Fri, Oct 18, 2013 at 05:34:22PM +0200, Rainer D. wrote:

Hi there,

> server {  
> listen 80 default\_server;

> server {  
> listen our.ip;

If your nginx.conf has only those two server{} blocks with only those  
two  
listen directives, then I would expect that every request that connects  
to our.ip will be handled by the second block; and every request that  
connects to any other IP address on the machine will be handled by the  
first block.

> Now, the problem is that while I can in principle access phpmyadmin,  
> (via [http://our.ip/phpmyadmin/](http://our.ip/phpmyadmin/) - I can login, databases are displayed  
> etc.) the images aren’t found anymore, because the requests for the  
> images end up at the non-default vhost rdudemotest2.

What happens if you remove the line “listen our.ip;”, or replace it with  
“listen 80;”?

If that doesn’t fix everything, can you describe one http request which  
does not do what you expect it to? And, in case it is not clear,  
describe  
how what it does do is not what you expect.

Best would probably be if you can show the “curl -i” or “curl -v”  
output.

## f

Francis D. removed\_email\_address@domain.invalid
