茅屋为秋风 发表于 2018-11-26 06:51:44

apache安装与配置

  本空间LAMP平台搭建(完整篇):http://hi.baidu.com/sndapk/blog/item/812bab22da5f1dfca2cc2b2d.html
  tar -zxvf httpd-2.2.22.tar.gz
cd httpd-2.2.22
./configure \
--prefix=/usr/local/apache \
--enable-so \
--enable-rewrite \
--enable-expires \
--enable-cache \
--enable-mem-cache
  make
  make install
  添加service程序管理
  chmod 700 /usr/local/apache/bin/apachectl
  ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd
  设置开机启动
  vi /etc/init.d/httpd顶部添加以下内容:
  #### Comments to support chkconfig on RedHat Linux# chkconfig: 35 85 15# description:http server
  ###
  保存退出
  chkconfig --add httpd ---35级别启动
  关闭防火墙
  Service iptables stop
  chkconfig --level 2345 iptables off
  启动apache
  service httpd start
  或
  /usr/local/apache/bin/apachectl -k start(不加-k查看进程也是默认加上-k执行)
  客户端访问:
  IT WORKS!
  ==================================================================================================
  配置apache支持php
  LoadModule php5_module modules/libphp5.so ---默认安装php后自动添加此行
  DocumentRoot "/data/webroot" ---更改网站根目录
  AddType application/x-httpd-php .php ---添加
  index.php ---添加,如果是php网站,置index.html前



页: [1]
查看完整版本: apache安装与配置