RedHat6.5  httpd实验的大概步骤

#解包
tar zxf httpd-2.2.17.tar.gz -C /usr/src
#切换到目录
cd /usr/src/httpd-2.2.17/
#编译
./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-charset-lite --enable-cgi && make && make install
#确认安装结果
ls /usr/local/httpd/
#优化执行路径
ln -s /usr/local/httpd/bin/* /usr/local/bin/
ls -l /usr/local/bin/httpd /usr/local/bin/apachectl
#查看版本
httpd -v
#添加httpd系统服务
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd
#!/bin/sh
# chkconfig: 35 85 15
# description: Startup script for the Apache HTTP Server
chkconfig --add httpd
chkconfig --list httpd

#配置域名解析
IP
192.168.174.130
网站名称
www.benet.com
 /etc/hosts修改配置文件

#配置httpd.conf
vim /usr/local/httpd/conf/httpd.conf
97行
ServerName www.benet.com
#检查
/usr/local/httpd/bin/apachectl -t
Syntax OK
#启动httpd服务
[root@lianxi httpd-2.2.15]# /etc/init.d/httpd start
[root@lianxi httpd-2.2.15]# netstat -anpt |grep httpd
tcp 0 0 :::80 :::* LISTEN 54646/httpd
#部署网页文档
[root@lianxi httpd-2.2.15]# cat /usr/local/httpd/htdocs/index.html
<html><body><h1>It works!</h1></body></html>
#在网页上访问
www.benet.com
#查看日志
tail /usr/local/httpd/logs/access_log
登陆信息等
tail /usr/local/httpd/logs/error_log
故障日志 notice是告警

#全局配置
ServerRoot 服务器根目录
Listen 设置监听端口
User 设置运行httpd进程时用户身份
Group设置运行httpd进程时组身份
ServerName 设置web站点
ServerAdmin设置管理员E-mail地址
DocumentRoot 设置网站站点目录
Directorylndex 设置网站默认的索引页(首页)可设置多个首页文件 以空格分开
ErrorLog 设置错误日志文件的路径
LogLevel 设置记录日志的级别路径 默认级别为warn(警告)
CustomLog 设置访问日志路径类型 common(通用格式)
PidFile 设置用于保存httpd进程号(PID)的文件
CharsetDefault 设置字符集
Include 包含一个配置文件内容,可以将一些特殊功能配置放到一个单独的文件中
再将Include配置项将其包含到httpd.conf这样便于独立配置功能的维护而不影响主配置文件

#区域配置
114行
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
Options:配置在特定目录使用哪些特性,常用的值和基本含义如下:
FollowSymLinks: 在该目录下允许文件系统使用符号连接。
AllowOverride:允许存在于.htaccess文件中的指令类型(.htaccess文件名是可以改变的,其文件名由AccessFileName指令决定):
Order:控制在访问时Allow和Deny两个访问规则哪个优先:
Allow:允许访问的主机列表(可用域名或子网,例如:Allow from 192.168.0.0/16)。
Deny:拒绝访问的主机列表。
Deny from all禁止访问

#安装AWStats分析系统
wget http://awstats.sourceforge.net/files/awstats-7.2.tar.gz
tar zxf awstats-7.3.tar.gz
mv awstats-7.3 /usr/local/awstats

#创建配置文件
cd /usr/local/awstats/tools/
chmod +x awstats_configure.pl
./awstats_configure.pl

#指定httpd主配置文件的路径
----- AWStats awstats_configure 1.0 (build 1.9) (c) Laurent Destailleur -----
This tool will help you to configure AWStats to analyze statistics for
one web server. You can try to use it to let it do all that is possible
in AWStats setup, however following the step by step manual setup
documentation (docs/index.html) is often a better idea. Above all if:
- You are not an administrator user,
- You want to analyze downloaded log files without web server,
- You want to analyze mail or ftp log files instead of web log files,
- You need to analyze load balanced servers log files,
- You want to 'understand' all possible ways to use AWStats...
Read the AWStats documentation (docs/index.html).

-----> Running OS detected: Linux, BSD or Unix

-----> Check for web server install

Enter full config file path of your Web server.
Example: /etc/httpd/httpd.conf
Example: /usr/local/apache2/conf/httpd.conf
Example: c:\Program files\apache group\apache\conf\httpd.conf
Config file path ('none' to skip web server setup):
> /usr/local/httpd/conf/httpd.conf

#设置文件类型
-----> Check and complete web server config file '/usr/local/httpd/conf/httpd.conf'
Warning: You Apache config file contains directives to write 'common' log files
This means that some features can't work (os, browsers and keywords detection).
Do you want me to setup Apache to write 'combined' log files [y/N] ? y
-----> Update model config file '/usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf'
File awstats.model.conf updated.

-----> Need to create a new config file ?
Do you want me to build a new AWStats config/profile
file (required if first install) [y/N] ? y

#指定web站点创建配置文件
-----> Define config file name to create
What is the name of your web site or profile analysis ?
Example: www.mysite.com
Example: demo
Your web site, virtual server or profile name:
> www.benet.com
回车

#修改站点统计配置文件
vim /etc/awstats/awstats.www.benet.com.conf
51行
LogFile="/usr/local/httpd/logs/access_log"
204行
DirData="/var/lib/awstats"
#创建目录
mkdir /var/lib/awstats
#执行日志分析,并设置cron任务计划
chmod +x awstats_updateall.pl
./awstats_updateall.pl now
crontab -e
crontab -l
*/5 * * * * /usr/local/awstats/tools/awstats_updateall.pl now
[root@lianxi tools]# /etc/init.d/crond start
[root@lianxi tools]# chkconfig --level 35 crond on
#访问AWStats
为了访问简单我们可以编辑一个配置文件
[root@lianxi tools]# vim /usr/local/httpd/htdocs/awb.html
<html>
<head>
<meta http-equiv=refresh content="0;
url=http://www.benet.com/awstats/awstats.pl?config=www.benet.com">
</head>
<body></body>
</html>

mkdir /var/www/html/accpcom -p
mkdir /var/www/html/benetcom -p
echo "<h1>www.benet.com</h1>" > /var/www/html/benetcom/index.html
echo "<h1>www.accp.com</h1>" > /var/www/html/accpcom/index.html
[root@httpd benetcom]# vim /etc/hosts
192.168.174.101 www.benet.com www.accp.com
127.0.0.1 httpd

基于域名的虚拟主机配置:
[root@httpd benetcom]# vim /usr/local/httpd/conf/extra/httpd-vhosts.conf
<Directory "/var/www/html"> 手动添加
Order allow,deny
Allow from all
</Directory>

NameVirtualHost 192.168.174.101 修改IP地址

<VirtualHost 192.168.174.101>
DocumentRoot "/var/www/html/benetcom" 指定网页根目录
ServerName www.benet.com
ErrorLog "logs/www.benet.com.error_log"
CustomLog "logs/www.benet.com.access_log" common
</VirtualHost>

<VirtualHost 192.168.174.101> 修改IP地址
DocumentRoot "/var/www/html/accpcom" 指定网页根目录
ServerName www.accp.com
ErrorLog "logs/www.accp.com.error_log"
CustomLog "logs/www.accp.com.access_log" common
</VirtualHost>

[root@httpd benetcom]# vim /usr/local/httpd/conf/httpd.conf
ServerName localhost:80
Include conf/extra/httpd-vhosts.conf 388行 把#去掉

/usr/local/httpd/bin/apachectl -t 检查语法
/usr/local/httpd/bin/apachectl restart 重启服务

####登录访问....

httpd基础配置和虚拟主机的配置方法的更多相关文章

  1. nginx的基本配置和虚拟主机的配置

    在Nginx配置文件(nginx.conf)中,一个最简化的虚拟主机配置代码如下: 跟Apache -样,Nginx也可以配置多种类型的虚拟圭机:一是基于IP的虚拟主机,二是基于域名的虚拟主机,三是基 ...

  2. apache2 httpd 基于域名的虚拟主机配置 for centos6X 和debian-8

    全系统虚拟主机: for debian 系统的apache2 域名 虚拟主机

  3. 配置Apache虚拟主机

    实验环境 一台最小化安装的CentOS 7.3虚拟机 配置基础环境 1. 安装apache yum install -y httpd 2. 建立虚拟主机的根目录 mkdir /var/wwwroot ...

  4. linux(十二)___Apache服务器用户认证、虚拟主机的配置

    创建xiangkejin  zhangsan两个用户 可看见文件中创建的两个用户: 建立虚拟目录并配置用户认证 ①建立虚拟目录 /xiangkejin ②在Apache的主配置文件httpd.conf ...

  5. apache中虚拟主机的配置

    一.两种方式:基于域名的虚拟主机和基于IP地址的的虚拟主机 (这里基于前者) 二.作用:实现在同一个web服务器下,同时运行很多个站点(项目) 三.虚拟主机的配置 1.在核心配置文件中加载虚拟主机配置 ...

  6. apache 虚拟主机详细配置:http.conf配置详解

    apache 虚拟主机详细配置:http.conf配置详解 Apache的配置文件http.conf参数含义详解 Apache的配置由httpd.conf文件配置,因此下面的配置指令都是在httpd. ...

  7. apache 多端口配置和虚拟主机配置

    1 打开httpd.conf文件 2 添加端口监听 (找到Lisen 80 在后面添加 Listen 端口号 如Listen 1112) port =>你的端口 project_name=> ...

  8. wamp虚拟主机的配置 .

    开发环境:WAMP 实例一,Apaceh配置localhost虚拟主机步骤 1,用记事本打开apache目录下httpd文件(如:D:\wamp\bin\apache\apache2.2.8\conf ...

  9. Web服务器(Apache)虚拟主机的配置

    一.定义    所谓虚拟主机是指在一台服务器里运行几个网站,提供WEB.FTP.Mail等服务.    二.虚拟主机的实现方法有三种:    基于IP的方法,基于主机名的方法和基于端口的法官法.    ...

随机推荐

  1. linux测试noatime对文件访问时间的影响

    linux测试noatime对文件访问时间的影响 文件(如abc)有3个时间: # stat abc Access: 2015-04-16 19:30:13.665970572 +0800 Modif ...

  2. Android 自定义标题栏

    开发 Android APP 经常会用到自定义标题栏,而有多级页面的情况下还需要给自定义标题栏传递数据. 本文要点: 自定义标题填充不完整 自定义标题栏返回按钮的点击事件 一.代码 这里先介绍一下流程 ...

  3. Using PL/SQL APIs as Web Services

    Overview Oracle E-Business Suite Integrated SOA Gateway allows you to use PL/SQL application program ...

  4. Xcode中iOS模拟器程序中的plist路径

    Xcode6.4里写了个简单的iOS程序在模拟器中跑. 其中用到了NSUserDefaults来保存属性文件plist,那么这个文件实际路径在哪里呢?在网上搜了一下,发现几种说法(*表示当前用户名): ...

  5. LeetCode之“数学”:Rectangle Area

    题目链接 题目要求: Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle i ...

  6. Android特效专辑(九)——仿微信雷达搜索好友特效,逻辑清晰实现简单

    Android特效专辑(九)--仿微信雷达搜索好友特效,逻辑清晰实现简单 不知不觉这个春节也已经过完了,遗憾家里没网,没能及时给大家送上祝福,今天回到深圳,明天就要上班了,小伙伴们是不是和我一样呢?今 ...

  7. UnityEditor下文件操作方法汇总(Unity3D开发之二十四)

    猴子原创,欢迎转载.转载请注明: 转载自Cocos2Der-CSDN,谢谢! 原文地址: http://blog.csdn.net/cocos2der/article/details/50595585 ...

  8. 使用Material Design Tint和视图详解

    视图 首先来讲Material Design 视图的概念,在新的api中,新添加了z轴的概念,z轴垂直于屏幕,用来表现元素的层叠关系,z值(海拔高度)越高,元素离界面底层(水平面)越远,投影越重,这里 ...

  9. AndroidStudio加快Gradle速度的方法-android study之旅(103)

    方法1 打开setting,搜索compiler ,按照如图配置,不要问我为什么,宝宝心里苦~ 方法2 到开项目的根目录的gradle.properties ,把下面的注释解除 org.gradle. ...

  10. Mina源码阅读笔记(三)-Mina的连接IoAccpetor

    其实在mina的源码中,IoService可以总结成五部分service责任.Processor线程处理.handler处理器.接收器和连接器,分别对应着IoService.IoProcessor.I ...