Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Web Server
  • Search

Pass real ip via nginx

Questions regarding the Web Server
Apache + Nginx, Nginx + PHP5-FPM
Post Reply
  • Print view
Advanced search
2 posts • Page 1 of 1
Danpiel
Posts: 2
Joined: Sat Jun 28, 2014 2:06 pm

Pass real ip via nginx
  • Quote

Post by Danpiel » Wed Jul 09, 2014 8:17 am

Hello, several customers using mod_authz features of apache server, especially ip based filtering for website parts, but nginx doesn't pass remote ip to apache server, it uses server ip address for all requests.

Please add those changes to the next updates of vesta

In nginx templates (/usr/local/vesta/data/templates/web/nginx/) add more options after proxy_pass

Code: Select all

....
proxy_pass http://%ip%:%web_port%;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
...
As for apache, there is mod_rpaf, here is config, note that you need to change RPAFproxy_ips YOUR_SERVER_IP

Code: Select all

<IfModule rpaf_module>
    RPAFenable On

    # When enabled, take the incoming X-Host header and
    # update the virtualhost settings accordingly:
    RPAFsethostname On

    # Define which IP's are your frontend proxies that sends
    # the correct X-Forwarded-For headers:
    RPAFproxy_ips 127.0.0.1 ::1
    RPAFproxy_ips YOUR_SERVER_IP

    # Change the header name to parse from the default
    # X-Forwarded-For to something of your choice:
#   RPAFheader X-Real-IP
</IfModule>
Resave web site configs in vesta panel and all access rules should now work.

Strange that vesta uses external server ip for proxying instead of loopback or unix socket.
Top

erldcrtz
Posts: 73
Joined: Tue Jun 10, 2014 6:16 am

Re: Pass real ip via nginx
  • Quote

Post by erldcrtz » Wed Jul 09, 2014 2:43 pm

I would suggest you to submit an enhancement request in their bug tracker if you want this to be heard right away

https://bugs.vestacp.com
Top


Post Reply
  • Print view

2 posts • Page 1 of 1

Return to “Web Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password