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
<VirtualHost
>
DocumentRoot /var/www/html/benetcom
ServerName www.benet.com
</VirtualHost>
<VirtualHost *>
DocumentRoot /var/www/html/accpcom
ServerName www.accp.com
</VirtualHost>
3.重启配置文件
/usr/local/httpd/bin/apachectl restart

转载于:https://blog.51cto.com/13550558/2086219

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值