gyts62 发表于 2018-11-17 13:31:23

Linux 中 Apache 的常用配置命令

  一 Apache的配置安装
  1.安装前卸载rpm包
  rpm -e httpd --nodeps
  2.编译安装4步骤:
  (1)tar zxf httpd-2.2.17.tar.gz -C /usr/src/
  (2)cd /usr/src/httpd-2.2.17
  ./configure --prefix=/usr/local/httpd--enable-so--enable-rewrite--enable-charset-lite--enable-cgi
  (3)make && make install
  3.优化路径
  ln -s /usr/local/httpd/bin/* /usr/local/bin/
  4.添加系统服务
  (1)cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
  (2)vim /etc/init.d/httpd

chkconfig: 35 85 15
  

    # description: Startup script for the Apache HTTP Server  

  (3)chkconfig --add httpd
  5.apache访问日志
  /usr/local/httpd/logs/access_log
  二 Apache的虚拟主机
  1.启用基于域名的虚拟主机
  vim/usr/local/httpd/conf/httpd.conf
  定位到388行,去除“#”号
  conf/extra/httpd-vhosts.conf
  2.配置虚拟主机文件
  vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
  NameVirtualHost :80
  
  DocumentRoot /var/www/html/benetcom
  ServerName www.benet.com
  
  
  DocumentRoot /var/www/html/accpcom
  ServerName www.accp.com
  
  3.重启配置文件
  /usr/local/httpd/bin/apachectl restart


页: [1]
查看完整版本: Linux 中 Apache 的常用配置命令