0

So I have a server with 1 interface "Eth0" and that interface has 2 IP's

192.168.0.10 -> Apache2
192.168.0.20 -> NginX

They share the same default gateway.

How can I make Firewall rules for each individual IP?

Definity
  • 127
  • 6

1 Answers1

0

You don't need configure firewall to do this. You need edit configs your web-servers to tell them which ip they should listen.

For apache2 edit /etc/apache2/ports.conf like this:

Listen 192.168.0.10:80

For nginx edit /etc/nginx/sites-enabled/default or other file with server { } like this:

server {
        listen 192.168.0.20:80 default_server;

Then restart your web-servers:

sudo systemctl restart apache2.service
sudo systemctl restart nginx.service

Now you can check which ip listen by each server:

sudo netstat -tulpn | grep 80
sudo ss -tulpn | grep 80