1. 程式人生 > >配置多網卡多IP的方式

配置多網卡多IP的方式

list family cat spa ont code web index tar

[[email protected] conf.d]# cat ip.conf

server {

????listen 10.0.0.7:80;

????server_name _;

?

????location / {

????????root /code_ip_eth0;

????????index index.html;

????}

}

?

server {

????listen 172.16.1.7:80;

????server_name _;

?

????location / {

????????root /code_ip_eth1;

????????index index.html;

????}

}

?

2.根據配置創建目錄

[[email protected] conf.d]# mkdir /code_ip_eth0

[[email protected] conf.d]# echo "Eth0" > /code_ip_eth0/index.html

?

[[email protected] conf.d]# mkdir /code_ip_eth1

[[email protected] conf.d]# echo "Eth1" > /code_ip_eth1/index.html

?

3.重啟nginx服務

[[email protected] conf.d]# systemctl restart nginx

?

4.使用curl命令測試

[[email protected] ~]# curl 172.16.1.7

Eth1

[[email protected] ~]# curl 10.0.0.7

Eth0

配置多網卡多IP的方式