N
N
Niko True2013-11-28 13:07:31
Nginx
Niko True, 2013-11-28 13:07:31

Nginx+apache+mod_rpaf wrong address definition?

The bottom line is that I configured nginx, apache2, installed mod_rpaf, configured it. The correct ip is written to the logs, but when I display REMOTE_ADDR on the page, for some reason 127.0.0.1 is displayed, and therefore, htaccess simply blocks folders.
Actually configs.
Host config:

location / {
        proxy_pass http://127.0.0.1:8080/;
        include     /etc/nginx/conf.d/proxy.conf;
}

proxy.conf
proxy_redirect              off;
proxy_set_header            Host $host;
proxy_set_header            X-Real-IP $remote_addr;
proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size        10m;
client_body_buffer_size     128k;
proxy_connect_timeout       90;
proxy_send_timeout          90;
proxy_read_timeout          90;
proxy_buffer_size           4k;
proxy_buffers               4 32k;
proxy_busy_buffers_size     64k;
proxy_temp_file_write_size  64k;

rpaf.conf
<IfModule rpaf_module>
        RPAFenable On
        RPAFsethostname Off
        RPAFproxy_ips 127.0.0.1 xxx.xxx.xxx.xxx
        RPAFheader X-Real-IP
</IfModule>

nginx 1.4.1, Apache 2.4.6

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Niko True, 2013-11-29
@buloshnik

Nevertheless, I decided)))))))))
I had to roll back to ubuntu 12.04, it seems to have long-term support, I installed:
apt-get install apache2 php5 libapache2-mod-php5 php5-mysql mysql-server mysql-client phpmyadmin
apt-get install nginx
apt-get install apache2-prefork-dev
Configured everything. Then :
cd /usr/local/src
wget www.stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
apxs2 -i -c -n mod_rpaf -2.0.so mod_rpaf-2.0.c
Without changing anything, in this version of ubuntu everything compiled immediately and without errors!
Well, then I connect the module accordingly, for it I prescribe only this:
RPAFenable On
RPAFproxy_ips 127.0.0.1 xx.xx.xx.xx Replacing
xx with my server's external ip
Reloading nginx and apache!)
Everything works!

N
Niko True, 2013-11-28
@buloshnik

Removed rpaf installed from reps.
Compiled by myself:
apt-get install apache2-prefork-dev
wget http://www.stderr.net/apache/rpaf/download/mod_rpaf-0.6.tar.gz
tar xzf mod_rpaf-0.6.tar.gz
cd mod_rpaf-0.6
apxs2 -i -c -n mod_rpaf-2.0.so mod_rpaf-2.0.c
Before compiling, I replaced remote_ip , remote_addr with client_ip, client_addr, respectively,
and reconfigured.
It got even worse, now it writes 127.0.0.1 to the logs
Well, really no one came across and can't help?

A
AutopilotNN, 2015-05-27
@AutopilotNN

Similar problem, but solved differently
location @apache {
# v1 is not always correctly determined ip
# resolver 127.0.0.1;
# proxy_pass http://$host:88;
# v2 Disable IP issue for two ips per server
# proxy_pass http://127.0.0.1:88;
# v3
proxy_pass http://$server_addr:88;
...
In addition for apache as above
RPAFproxy_ips 127.0.0.1 XXX.XXX.XXX.XXX

N
Nog, 2020-06-25
@Nog

Had the same issue of a non-working RPAF. Installed on Centos6 via yum. As a result, it didn't work.
As a result, I decided to compile the module myself. Removed the installed module via yum. Well, then everything is simple:

yum install httpd-devel
mkdir /tmp/222
cd /tmp/222
git clone https://github.com/gnif/mod_rpaf.git
make
make install

Here we installed RPAF (look for the presence of /etc/httpd/modules/mod_rpaf.so). Next, you need to configure it.
Create a file /etc/httpd/conf.d/mod_rpaf.conf with the content:
LoadModule              rpaf_module modules/mod_rpaf.so

RPAF_Enable             On
RPAF_ProxyIPs           127.0.0.1
RPAF_SetHostName        On
RPAF_SetHTTPS           On
RPAF_SetPort            On
RPAF_ForbidIfNotProxy   Off

Instead of 127.0.0.1, you can specify a list of IPs separated by a space from which requests come (for example, add the IP of your server)
reload httpd
service httpd restart
And check $_SERVER['REMOTE_ADDR']

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question