linux网站中虚拟主机的达成
发布时间:2022-07-15 16:18:44 所属栏目:Linux 来源:互联网
导读:一台Linux中网站虚拟主机的完成主要有三种方式:a、根据ip地址;b、根据端口号;c、根据域名。一下为完成进程:(本试验的Linux虚机系统为rhel5.6) 1、基于域名的实现: 这种方式需要搭建dns域名服务器。 # cat /etc/sysconfig/network-scripts/ifcfg-eth0
一台Linux中网站虚拟主机的完成主要有三种方式:a、根据ip地址;b、根据端口号;c、根据域名。一下为完成进程:(本试验的Linux虚机系统为rhel5.6) 1、基于域名的实现: 这种方式需要搭建dns域名服务器。 # cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static IPADDR=192.168.22.133 nameserver 192.168.22.133 search httpd.com #yum install httpd -y # vim /etc/httpd/conf/httpd.conf NameVirtualHost 192.168.22.133:80 #将这一行注释符取消掉,*号改成ip地址 <VirtualHost 192.168.22.133:80> #复制粘贴即可得到以下几行(nyy p) ServerAdmin webmaster@dummy-host.example.com DocumentRoot /www/bbs ServerName bbs.httpd.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> <VirtualHost 192.168.22.133:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot /www/news ServerName news.httpd.com ErrorLog logs/dummy-host.example.com-error_log CustomLog logs/dummy-host.example.com-access_log common </VirtualHost> #service network restart #service httpd start #yum install bind bind-chroot bind-utils caching-nameserver -y #cd /var/named/chroot/etc #cp -a named.caching-nameserver.conf named.conf #vim named.conf options { listen-on port 53 { any; }; directory "/var/named"; dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt"; allow-query { any; }; allow-query-cache { any; }; }; #touch httpd.com.zone #touch 22.168.192.zone #cat localhost.zone > httpd.com.zone #cat named.local > 22.168.192.zone #vim httpd.com.zone $TTL 86400 @ IN SOA @ root ( (编辑:应用网_丽江站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐
热点阅读