WWW服务:
Apache
卸载httpd:
[root@bogon ~]# yum remove httpd
查询httpd是否安装:
[root@bogon ~]# rpm -qa|grep httpd
安装httpd
[root@bogon ~]# yum install httpd
进入httpd主配置文件:
[root@bogon ~]# vi /etc/httpd/conf/httpd.conf
修改主配置文件:
262 ServerAdmin [email protected] 改不改都可以
276 ServerName www.123.com:80
402 DirectoryIndex index.html index.html.var a.html
创建网站主文件
[root@bogon ~]# cd /var/www/html/
[root@bogon html]# touch a.html 创建一个a.html的文件
[root@bogon html]# echo "hello">a.html 将hello放入a.html中
[root@bogon html]# cat a.html 查看a.html中的内容
hello
[root@bogon html]#
启动服务:
[root@bogon html]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
安装命令行的浏览器
[root@bogon ~]# yum install lynx
测试网站
[root@bogon ~]# lynx www.123.com
关闭防火墙
[root@bogon ~]# service iptables stop
虚拟主机的网站
www.123.com
www1.123.com
www2.123.com
[root@bogon named]#cd /var/named
[root@bogon named]# vi z
$TTL 1D
@ IN SOA @ rname.invalid. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS @
A 192.168.1.100
www A 192.168.1.100
www1 A 192.168.1.100
www2 A 192.168.1.100
[root@bogon named]# service named restart
Stopping named: .[ OK ]
Starting named: [ OK ]
[root@bogon named]# vi /etc/httpd/conf/httpd.conf
NameVirtualHost 192.168.1.100:80
#
# NOTE: NameVirtualHost cannot be used without a port specifier
# (e.g. :80) if mod_ssl is being used, due to the nature of the
# SSL protocol.
#
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for requests without a known
# server name.
DocumentRoot /var/www/html
ServerName www.123.com
DirectoryIndex a.html
DocumentRoot /www1
ServerName www1.123.com
DirectoryIndex b.html
DocumentRoot /www2
ServerName www2.123.com
DirectoryIndex c.html
启动服务:
[root@bogon html]# service httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
DocumentRoot /var/www/html
ServerName www.123.com
DirectoryIndex a.html
DocumentRoot /www1
ServerName www1.123.com
DirectoryIndex b.html
DocumentRoot /www2
ServerName www2.123.com
DirectoryIndex c.html
注意路径!!!