Apache httpd 安装使用总结

发布时间: 更新时间: 总字数:326 阅读时间:1m 作者: IP属地: 分享 复制网址

ubuntu安装apache过程总结

介绍

配置介绍:

  • /etc/httpd/conf/httpd.conf
  • DocumentRoot告诉httpd去哪找内容
  • yum install elinks elinks是命令行浏览器
  • /etc/httpd/conf.d目录下,新建文件,里面设置<VirtualHost *:80>

安装

CentOS

yum install httpd

源码

方法

  • 下载
wget http://www.apache.org/dist/httpd/httpd-2.0.65.tar.gz
  • 解压
tar zxvf httpd-2.0.63.tar.gz
  • 进入目录
httpd-2.0.63
  • 安装
./configure -prefix=/usr/local/apache2 -enable-module=so
  • 编译
make
  • 安装
make install
  • 启动
/usr/local/apache2/bin/apachectl start
/usr/local/apache2/bin/apachectl restart
  • 测试
http://localhost

配置示例

nagios

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
# Last Modified: 11-26-2005
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file.  Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin/ "/usr/lib64/nagios/cgi-bin/"

<Directory "/usr/lib64/nagios/cgi-bin/">
#  SSLRequireSSL
   Options ExecCGI
   AllowOverride None

   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios/passwd

   <IfModule mod_authz_core.c>
      # Apache 2.4
      <RequireAll>
         Require all granted
         # Require local
         Require valid-user
      </RequireAll>
   </IfModule>
   <IfModule !mod_authz_core.c>
      # Apache 2.2
      Order allow,deny
      Allow from all
      #  Order deny,allow
      #  Deny from all
      #  Allow from 127.0.0.1
      Require valid-user
   </IfModule>
</Directory>

Alias /nagios "/usr/share/nagios/html"

<Directory "/usr/share/nagios/html">
#  SSLRequireSSL
   Options None
   AllowOverride None

   AuthName "Nagios Access"
   AuthType Basic
   AuthUserFile /etc/nagios/passwd

   <IfModule mod_authz_core.c>
      # Apache 2.4
      <RequireAll>
         Require all granted
         # Require local
         Require valid-user
      </RequireAll>
   </IfModule>
   <IfModule !mod_authz_core.c>
      # Apache 2.2
      Order allow,deny
      Allow from all
      #  Order deny,allow
      #  Deny from all
      #  Allow from 127.0.0.1
      Require valid-user
   </IfModule>
</Directory>
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数