Strange proxy_pass problem
Rainer Duffner
rainer at ultra-secure.de
Fri Oct 18 15:34:22 UTC 2013
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):
<VirtualHost _default_:8080>
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
</Directory>
(php is chrooted with php-fpm)
and then there's a "normal" vhost like this:
<VirtualHost *:8080>
ServerAdmin rdudemotest2 at 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
</Directory>
FastCgiExternalServer /home/www/fastcgi/rdudemotest2.server -socket
rdudemotest2.sock
Alias /php.fcgi /home//www/fastcgi/rdudemotest2.server </VirtualHost>
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?
More information about the nginx
mailing list