1.       增加IP

2.       [root@NFS-Server ~]# ifconfigeth0:1 192.168.47.137 netmask 255.255.255.0 up 

3.       [root@NFS-Server ~]# ifconfigeth0:2 192.168.47.136 netmask 255.255.255.0 up 

4.       [root@NFS-Server ~]# ifconfigeth0:0 192.168.47.135 netmask 255.255.255.0 up 

5.       [root@NFS-Server ~]# ifconfig

6.       eth0      Link encap:Ethernet  HWaddr 00:0C:29:77:67:FC 

7.                 inet addr:192.168.47.133  Bcast:192.168.47.255  Mask:255.255.255.0

8.                 inet6 addr:fe80::20c:29ff:fe77:67fc/64 Scope:Link

9.                 UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

10.             RX packets:30620 errors:0 dropped:0overruns:0 frame:0

11.             TX packets:39515 errors:0 dropped:0overruns:0 carrier:0

12.             collisions:0 txqueuelen:1000

13.             RX bytes:20200009 (19.2 MiB)  TX bytes:4338620 (4.1 MiB)

14.             Interrupt:19 Base address:0x2000

15.    

16.   eth0:0    Link encap:Ethernet  HWaddr 00:0C:29:77:67:FC 

17.             inet addr:192.168.47.137  Bcast:192.168.47.255  Mask:255.255.255.0

18.             UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

19.             Interrupt:19 Base address:0x2000

20.    

21.   eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:77:67:FC 

22.             inet addr:192.168.47.136  Bcast:192.168.47.255  Mask:255.255.255.0

23.             UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

24.             Interrupt:19 Base address:0x2000

25.    

26.   eth0:2    Link encap:Ethernet  HWaddr 00:0C:29:77:67:FC 

27.             inet addr:192.168.47.135  Bcast:192.168.47.255  Mask:255.255.255.0

28.             UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1

29.             Interrupt:19 Base address:0x2000

30.    

31.   lo        Link encap:Local Loopback 

32.             inet addr:127.0.0.1  Mask:255.0.0.0

33.             inet6 addr: ::1/128 Scope:Host

34.             UP LOOPBACK RUNNING  MTU:65536 Metric:1

35.             RX packets:12 errors:0 dropped:0overruns:0 frame:0

36.             TX packets:12 errors:0 dropped:0overruns:0 carrier:0

37.             collisions:0 txqueuelen:0

38.             RX bytes:840 (840.0 b)  TX bytes:840 (840.0 b)

 

配置虚拟主机:

[root@NFS-Serverextra]# vi  nginx_vhosts.conf 

server {

        listen       192.168.47.135:8060;

        server_name  192.168.47.135;

       location / {

            root   /data0/www/www;

            index  index.html index.htm;

            access_log /app/logs/www_access.logmain;

        }

   }

        ###

     server {

        listen      192.168.47.136:8070;

        server_name  192.168.47.136;

       location / {

            root   /data0/www/bbs;

            index  index.html index.htm;

              access_log /app/logs/bbs_access.logmain;

        }

   }

       ###

        server {

        listen      192.168.47.136:8081;

        server_name  192.168.47.136;

       location / {

            root   /data0/www/blog;

            index  index.html index.htm;

              access_log/app/logs/blog_access.log main;

        }

   }

 ###

server

{

 listen 80;

 server_name status.etiantian.org;

 location /{

 stub_status on;

 access_log off;

  }

}

[root@NFS-Serverextra]# ../../sbin/nginx -t

nginx:the configuration file /application/nginx-1.10.1/conf/nginx.confsyntax is ok

nginx:configuration file /application/nginx-1.10.1/conf/nginx.conftest is successful

[root@NFS-Serverextra]# ../../sbin/nginx -s reload

 nginx基于IP的虚拟主机配置_第1张图片