- 论坛徽章:
- 0
|
本帖最后由 wensnort 于 2012-06-13 22:34 编辑
我的linux系统版本是CentOS6.2,apache版本是2.2.15,我配置的虚拟主机为什么打不开呢,开打的都是默认主页,求大神解决,下面附配置:
为了不耽大神的时间,我修改的地方,已用绿色标注出来
etc/httpd/conf/httpd.conf 文件的详细配置
NameVirtualHost 192.168.2.158:80
<VirtualHost 192.168.2.158:80>
ServerName www.testone.com
DocumentRoot /home/testone
</VirtualHost>
<VirtualHost 192.168.2.158:80>
ServerName www.testtwo.com
DocumentRoot /home/testtwo
</VirtualHost>
<Directory /home>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
其他配置
[root@centos-2 桌面]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.2.158 www.testone.com
192.168.2.158 www.testtwo.com
[root@centos-2 桌面]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:0C:29:14:BA:E1
inet addr:192.168.2.158 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe14:bae1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4640 errors:0 dropped:0 overruns:0 frame:0
TX packets:183 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1354746 (1.2 MiB) TX bytes:36431 (35.5 KiB)
Interrupt:19 Base address:0x2024
[root@centos-2 桌面]# cd /home
[root@centos-2 home]# ls -l
总用量 60
-rw-r--r--. 1 root root 8568 6月 13 15:07 httpd
-rw-r--r--. 1 root root 34418 6月 13 11:53 httpd.conf_bak
drwx------. 27 snort snort 4096 6月 13 12:29 snort
drwxr-xr-x. 2 root root 4096 6月 13 12:38 testone
drwxr-xr-x. 2 root root 4096 6月 13 12:39 testtwo
[root@centos-2 home]# cd testone/
[root@centos-2 testone]# ls -l
总用量 4
-rwxrwxrwx. 1 root root 21 6月 13 12:38 index.html
[root@centos-2 testone]# cat index.html
this is test one web
[root@centos-2 testone]#
启动httd是提示的错误和使用httpd -S提示的信息:
[root@centos-2 testone]# service httpd restart
停止 httpd: [确定]
正在启动 httpd:httpd: apr_sockaddr_info_get() failed for centos-2
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[确定]
[root@centos-2 testone]# httpd -S
httpd: apr_sockaddr_info_get() failed for centos-2
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
VirtualHost configuration:
192.168.2.158:80 is a NameVirtualHost
default server www.testone.com (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost www.testone.com (/etc/httpd/conf/httpd.conf:1013)
port 80 namevhost www.testtwo.com (/etc/httpd/conf/httpd.conf:101
wildcard NameVirtualHosts and _default_ servers:
_default_:443 127.0.0.1 (/etc/httpd/conf.d/ssl.conf:74)
Syntax OK
[root@centos-2 testone]#
最后的提示
|
|