Strange proxy_pass problem

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;
}
location /phpmyadmin/ {
include proxy.conf ;
proxy_pass 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;
}
}

Now, the problem is that while I can in principle access phpmyadmin,
(via 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?

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/ - 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. [email protected]