Getting original visitor IPs for CentOS?

I’ve got the following configuration:
OS CentOS Linux 8
Plesk Obsidian Version 18

I need to get original visitors IP for my site.

I’ve read this article -
But I couldn’t find any mentions about CentOS. :frowning:

Does it mean that this option mod_remoteip is not compatible for CentOS?
Please explain.

CentOS is an operating system not a webserver

I don’t know what Plesk is but apparently it uses Apache, so try following the Apache one

Thanks for the reply,
According to help article -
Apache 2.4-

  1. Make sure the following is installed:
  • Red Hat/Fedora sudo yum install httpd-devel libtool git
  • Debian/Ubuntu sudo apt-get install apache2-dev libtool git

There is no info about CentOS
Screenshot is attached
Does it mean that all the same as for Red Hat or Ubuntu the same for CentOS?

I think CentOS uses the yum package manager, do you run into any issues following the Red Hat/Fedora instructions? I believe all three of those operating systems are very similar

Thanks for your comment.
Honestly, I’m not so familiar with Red Hat/Fedora or Debian/Ubuntu or CentOS
The main question for me: what’s the type of OS compatible with CentOS?
Do you advise?
Acc. to this answer -
it looks that Debian = CentOS
Quote: “CentOS and Ubuntu Linux are open source which use the kernel of Debian Linux.”

Does it mean the Debian commands will work for CentOS?

CentOS uses YUM (Yellow dog Updater, Modified). If you’re using Apache though, use mod_remoteip. I haven’t used CentOS in some time, but if I recall, remoteip is a default with the CentOS Apache build.

# httpd -M | grep "remote"
# apachectl -M | grep "remote"

I tried sudo yum install httpd-devel libtool git
it told me error message -

[root@plesk ~]# sudo apt-get install apache2-dev libtool git
sudo: apt-get: command not found
[root@plesk ~]# sudo yum install httpd-devel libtool git
CentOS Linux 8 - AppStream                                                               511  B/s |  38  B     00:00
Error: Failed to download metadata for repo 'appstream': Cannot prepare internal mirrorlist: No URLs in mirrorlist

Those are the Apache instructions for using mod_cloudflare which is no longer supported. As I’d said, use mod_remoteip instead.

If you’re using Apache, which you appear to be based on your posts, did you run the commands in my previous post to see if remoteip is active or not? It’s been a while since I’ve used CentOS specifically, but if I recall though, remoteip is a default of the CentOS Apache build. If so, all you need to do is configure it accordingly.

As for your metadata error, this may or may not help you:

I’ve run your command -

[root@plesk ~]# httpd -M | grep "remote"
 remoteip_module (shared)

see attached screenshot -

Is it ok for me? What the next step according to manual ?
Could you explain?

You just need to do the configuration of mod_remoteip accordingly.

With CentOS, some of the paths and such may be different. For example, you may find the remoteip confguration file at something like /etc/httpd/conf.modules.d/ instead of /etc/apache2/conf-available/.

I can’t tell you the exact paths for the CentOS installation offhand, it’s been a while now since I’ve used CentOS specifically. But, Restoring original visitor IPs – Cloudflare Help Center has the configurations that you need to add to your installation though.

1 Like