We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
Nginx - get real IP through X-Forwarded-For headers
Nginx - get real IP through X-Forwarded-For headers
I run a mediawiki installation undera vestaCP and I need real ips to monitor contributions ip addresses, the problem is since I moved to a server with VestaCP all the contributions are listed under the same IP address which is the address of the server which I have tracked to be an issue related with nginx configuration and mediawiki supports that out of the box through this http://serverfault.com/questions/526547 ... 551#526551
The problem is that Im not very knowledgable in server stuff and I have been reading through nginx and vesta documentation and I haven't found the solution to nginx config
I have a SERVER_IP.conf which lists the following
I assume the problem is there and I want to be able to pass the real ip to media wiki through the X-Forwarded-For headers. How do I do that?
The problem is that Im not very knowledgable in server stuff and I have been reading through nginx and vesta documentation and I haven't found the solution to nginx config
I have a SERVER_IP.conf which lists the following
Code: Select all
server {
listen SERVER_IP:SERVER_PORT default;
server_name _;
#access_log /var/log/nginx/SERVER_IP.log main;
location / {
proxy_pass http://SERVER_IP:SERVER_PORT;
}
}
server {
listen 80;
server_name comp.tf;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://127.0.0.1:4567/;
proxy_redirect off;
# Socket.IO Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Re: Nginx - get real IP through X-Forwarded-For headers
you're on the right track at least. every request made is received by nginx which serves as a reverse proxy in front of your apache installation.
easiest way to get rid of that problem would be to switch of proxy support for your affected domain within vesta.
depending on your needs you wouldn't benefit from fast loading static-files via nginx after that change...
if you prefer to run that proxied setup you should look into configuring the domain-related config file (probably the SERVER_IP.conf would help that much) to something like:
be advised that vesta will overwrite changes to the domain-related files whenever something is changed on the domain-settings via controlpanel, so you probably need to make that changes in the template for the web-config you are running.
even adding this in the included file for custom changes won't work, as you can't define the /location block a second time.
easiest way to get rid of that problem would be to switch of proxy support for your affected domain within vesta.
depending on your needs you wouldn't benefit from fast loading static-files via nginx after that change...
if you prefer to run that proxied setup you should look into configuring the domain-related config file (probably the SERVER_IP.conf would help that much) to something like:
Code: Select all
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://SERVER_IP:SERVER_PORT;
}
even adding this in the included file for custom changes won't work, as you can't define the /location block a second time.