今天配置了apache的多虚拟主机,基于端口的,基于IP的,基于域名的,都配置了,这些测试也成功。

之后,就接着配置多虚拟主机的mod_expires,关于mod_expires的文件就不贴在这里了,网上很多,类似的。

可是配置了之后,对apache进行apache优雅重启,但是报错如下:

 

  1. [root@*** logs]# /application/apache2.2.23/bin/apachectl graceful  
  2. httpd not running, trying to start  
  3. (98)Address already in use: make_sock: could not bind to address [::]:80  
  4. (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80  
  5. no listening sockets available, shutting down  
  6. Unable to open logs 

仔细检查,没发现配置方面的错误,包括主配置文件,虚拟机配置文件都正确。

报错信息的提示是,端口已经在使用了,不能绑定到指定的端口上。

仔细想想,已经有apache在启动了,用ps查进程,再杀掉。

 

  1. [root@cahop logs]# ps -ef | grep httpd  
  2. root      3677  2878  0 18:35 pts/1    00:00:00 grep httpd  
  3. root      5536     1  0 10:44 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  4. daemon   10203  5536  0 11:45 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  5. daemon   10204  5536  0 11:45 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  6. daemon   10206  5536  0 11:45 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  7. daemon   10208  5536  0 11:45 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  8. daemon   10300  5536  0 11:46 ?        00:00:00 /application/apache2.2.23/bin/httpd -k start  
  9. [root@cahop logs]# killall httpd
    [root@cahop logs]#
    [root@cahop logs]#

 

再进行apache优雅重启,正常了,测试mod_expires(可以看到,已经为html文件生成缓存了),OK。

 

  1. [root@cahop logs]# curl -I 192.168.88.128:8081  
  2. HTTP/1.1 200 OK  
  3. Date: Sun, 02 Dec 2012 10:41:04 GMT  
  4. Server: Apache/2.2.23 (Unix) DAV/2  
  5. Last-Modified: Sun, 02 Dec 2012 03:10:51 GMT  
  6. ETag: "2d802d-63-4cfd5fae2e4c0" 
  7. Accept-Ranges: bytes  
  8. Content-Length: 99  
  9. Cache-Control: max-age=31104000  
  10. Expires: Wed, 27 Nov 2013 10:41:04 GMT  
  11. Content-Type: text/html