vim /etc/sysconfig/network-scripts/ifcfg-eth0
修改如下内容
xxxxxxxxxxBOOTPROTO=staticIPADDR=192.168.xxx.1NETMASK=255.255.255.0
重启网络 service network restart
xxxxxxxxxxsetenforce 0
xxxxxxxxxxservice iptables stop
或者使用setup命令,选择Firewall configuration下的Security Level并设置为Disabled,然后保存退出
xxxxxxxxxxrpm -ivh httpd-2.2.15-39.el6.i686.rpm
xxxxxxxxxxvim /etc/httpd/conf/httpd.conf
xxxxxxxxxxuser add longpasswd longchmod 705 /home/longmkdir /home/long/public_htmlcd /home/long/public_htmlecho "This is Long's web" >> index.html
配置文件中
xxxxxxxxxx<IfModule mod_userdir.c>UserDir disabled#UserDir public_html</IfModule>
修改为
xxxxxxxxxx<IfModule mod_userdir.c>#UserDir disabledUserDir public_html</IfModule>
浏览格式为
xxxxxxxxxxhttp://域名或IP/~username
xxxxxxxxxxmkdir -p /virdir/cd /virdir/echo "This is Virtual Directory sample" >> index.htmlchmod 705 index.html
配置文件中添加
xxxxxxxxxxAlias /test "/virdir"
浏览
xxxxxxxxxxhttp://域名或IP/test
即可看到虚拟目录中的页面
xxxxxxxxxxcd /etc/sysconfig/network-scripts/cp -p ifcfg-eth0 ifcfg-eth0:1vim ifcfg-eth0:1
修改如下内容
xxxxxxxxxxDEVICE=eth0:1BOOTPROTO=staticIPADDR=192.168.xxx.1NETMASK=255.255.255.0
重启网络
xxxxxxxxxxservice network restart
分别创建/var/www/ip1和/var/www/ip2
xxxxxxxxxxmkdir /var/www/ip1 /var/www/ip2cd /var/www/ip1echo "This is 192.168.xxx.1's web" >> index.htmlcd /var/www/ip2echo "This is 192.168.xxx.2's web" >> index.html
xxxxxxxxxxvim /etc/httpd/conf/httpd.conf
到达文件末尾(G) 复制文件末尾最后7行(7yy) 粘贴(p)
xxxxxxxxxx#<VirtualHost *:80># ServerAdmin webmaster@dummy-host.example.com# DocumentRoot /www/docs/dummy-host.example.com# ServerName dummy-host.example.com# ErrorLog logs/dummy-host.example.com-error_log# CustomLog logs/dummy-host.example.com-access_log common#</VirtualHost>
删去注释并修改
xxxxxxxxxx<VirtualHost 192.168.xxx.1>...DocumentRoot /var/www/ip1...</VirtualHost><VirtualHost 192.168.xxx.2>...DocumentRoot /var/www/ip2...</VirtualHost>
xxxxxxxxxxhttp://192.168.xxx.1http://192.168.xxx.2
操作同上(2)(3)(4),不过要添加Listen 端口号,在IP后加“:端口“
xxxxxxxxxxListen 8080Listen 8090...<VirtualHost 192.168.xxx.1:8080>...DocumentRoot /var/www/port8080...</VirtualHost><VirtualHost 192.168.xxx.1:8090>...DocumentRoot /var/www/port8090...</VirtualHost>
xxxxxxxxxxcd /media/RHEL-6.6\ Server.i386/Packagesrpm -ivh bind-9.8.2-0.30.rc1.el6.i686.rpm
修改配置文件
xxxxxxxxxxvim /etc/named.conf
修改如下内容
xxxxxxxxxxlisten on port 53 { any; }...allow-query { any; }
xvim /etc/named.rfc1912.zones
复制最后11行(11yy) 粘贴(p)修改为
xxxxxxxxxxzone "long.com" IN {type master;file "long.com.zone";allow-update { none; };};
xxxxxxxxxxcd /var/namedcp -p named.localhost long.com.zonevim long.com.zone
编辑如下
xxxxxxxxxx$TTL 1D@ IN SOA @ root.long.com. (0 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimumNS @A 127.0.0.1AAAA ::1dns IN A 192.168.29.1aaa IN A 192.168.29.1bbb IN A 192.168.29.1
xxxxxxxxxxmkdir /var/www/aaa /var/www/bbbcd /var/www/aaaecho "This is aaa web" >> index.htmlcd /var/www/bbbecho "This is bbb web" >> index.html
xxxxxxxxxxNameVirtualhost 192.168.xxx.1...<VirtualHost 192.168.xxx.1>...ServerName aaa.long.comDocumentRoot /var/www/aaa...</VirtualHost><VirtualHost 192.168.xxx.1>...ServerName bbb.long.comDocumentRoot /var/www/bbb...</VirtualHost>
xxxxxxxxxxhttp://aaa.long.comhttp://bbb.long.com