Welcome! Log In Create A New Profile

Advanced

Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

October 17, 2010 04:12PM
Hi,

First of all, my setup:
Debian 5
Apache 2,
Nginx 0.6.32 as Proxy
PHP 5 as Apache module
All installed via apt
And, (important data), the server handles 5 different ips wich are distributed among several websites, so both apache and nginx are listening to several ips at the same time.

My problem is that php info is reporting SERVER_ADDR as 127.0.0.1, and Im trying to install an app wich needs to report the server's ip back to a central (external) server. Since it;s reporting 127.0.0.1, I cant make it work.

I've tryed different aproaches to solve the problem but with no luck so far.

I apreciate some help to solve this.

Some of my config files:

nginx.conf (relevant info)
[code]
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 64;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

#access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;

gzip on;
gzip_types text/plain text/css text/javascript text/html application/x-javascript;
upstream apache {
server 127.0.0.1:8888;
}

# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*;
include /etc/nginx/sites-enabled/*;

#
# The default server
#

}[/code]

virtualhost:
[code]
server {

server_tokens off;
listen EXTERNAL_IP_3:80;

server_name example.com www.example.com;

location ~ \.(flv|css|js|ico|jpg|png|gif|swf|torrent)$ {
root /home/example/public_html/;
break;
}

location / {
default_type text/html;

proxy_pass http://apache;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 120;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;


}
}
[/code]


apache virtual host:
[code]
<VirtualHost EXTERNAL_IP_3:8888>
DocumentRoot /home/example/public_html
DirectoryIndex index.php index.htm index.html
ServerName example.com
ServerAlias www.example.com
CustomLog /var/log/apache2/access_example.log combined
ErrorLog /var/log/apache2/apacheerror_example.log
<Directory "/home/example/public_html/">
Options +FollowSymLinks
AllowOverride All
Order deny,allow
allow from all
RewriteEngine On
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</Directory>
</VirtualHost>
[/code]


phpinfo() (relevant info):
[code]
SERVER_SOFTWARE Apache
SERVER_NAME www.example.com
SERVER_ADDR 127.0.0.1
SERVER_PORT 80
REMOTE_ADDR 192.168.0.2 (Client IP)
[/code]


Thank you guys!
Subject Author Posted

Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 17, 2010 04:12PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Jim Ohlstein October 17, 2010 04:58PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 17, 2010 04:59PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Jim Ohlstein October 17, 2010 06:14PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 12:28AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 12:30AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Igor Sysoev October 18, 2010 02:26AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 03:16AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Igor Sysoev October 18, 2010 03:24AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 03:32AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Igor Sysoev October 18, 2010 05:46AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 12:04PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Igor Sysoev October 18, 2010 12:14PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

DarkPepe October 18, 2010 12:25PM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

mtk April 30, 2011 06:01AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

mtk April 30, 2011 06:13AM

Re: Nginx Proxy + Apache and php5 as apache module SERVER_ADDR problem (HELP!)

Igor Sysoev October 18, 2010 03:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 270
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready