Proxy_pass with runtime variables?

Igor Sysoev igor at sysoev.ru
Fri Apr 2 12:03:56 MSD 2010


On Fri, Apr 02, 2010 at 12:00:01PM +0800, Quan Zhou wrote:

> Hi all,
> 
> I'm having issues with reverse proxy on Nginx
> 
> I was setting up a reverse proxy listening [::0]:80 acts as 6 to 4 server on
> Nginx, so I've tried $host, $server_name, $http_host in proxy_pass field,
> but they all failed, and server threw same error:
> 
> 
>  [emerg]: invalid number of arguments in "proxy_pass" directive in
> /etc/nginx/sites-enabled/reverse.proxy:16
> 
> 
> Here's my configuration file:
> 
> server {
>         listen   [::0]:80;
>         server_name  *.*;

"*.*" is invalid server_name.

>         access_log  off;
>         error_log off;
> 
>         location /{
>                 proxy_pass $server_name

-                 proxy_pass $server_name
+                 proxy_pass $server_name;

or probably

-                 proxy_pass $server_name
+                 proxy_pass $host;


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list