Ngnix as Proxy with Multiple Directories Issue

ckozler nginx-forum at
Fri Aug 19 14:24:48 UTC 2011

Hi Everyone,

I am having an odd issue here with Ngnix as a my proxy for my pages
served up by Apache.  This is a pretty vanilla proxy setup - the issues
I am facing (and my respective config) are as follows:

I have my DNS and everything setup properly so I know that is not an
issue.  All requests to and licensing are sent to
the Ngnix web proxy and I can confirm that it is not in fact any DNS
issue.  With that - 

The issue:

Whenever I type licensing/downloads or
it redirects me to http://licensing/ and
(respectively depending on which request was made) - the same goes for
the downloads domain as well.

I am thinking I need to add a location block for every directory that I
want to proxy for but that seems a little wrong - shouldnt any request
to regardless of the directory path be
automatically resolved and not auto-appended as such?

My configuration

worker_processes  50;

events {
    worker_connections  1024;

http {
	# Debugging M2 error
	error_log	/var/log/nginx/debug.err.log debug;
	proxy_buffer_size 64k;
	proxy_buffers 4 64k;
	proxy_busy_buffers_size 128k;
	proxy_temp_file_write_size 128k;
	client_body_buffer_size 1024m;
	keepalive_timeout 500;
	include       mime.types;
    	default_type  application/octet-stream;
    	sendfile        on;

	client_max_body_size 500m;

	server {
		listen		80;	
		server_name licensing;

		location / {
                        proxy_set_header Host $host;
                        proxy_set_header        X-Real-IP      
                        proxy_set_header X-Forwarded-For

	# Download portal
	server {
		listen		80;
		server_name	downloads;
		location / {
			#proxy_set_header Host $http_host;
			proxy_set_header Host $Host;
			proxy_set_header        X-Real-IP       $remote_addr;
			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
		#location uploads {
		#	proxy_pass http://$http_host/uploads;
		#	proxy_set_header Host $http_host;
		#	proxy_set_header	X-Real-IP	$remote_addr;


Posted at Nginx Forum:,214049,214049#msg-214049

More information about the nginx mailing list