linux可以http安装么,Linux 5下 http的安装

Web网站服务(一)

http.conf中的全局配置

ServerRoot:用于设置httpd服务的根目录,该目录中包括运行Web站点必须的目录和文件。默认根目录为:/usr/local/apache2

Listen:用于设置Apache服务器监听的网络端口号,默认为80

User:用于设置运行httpd进程的用户身份。

Group:用于设置运行httpd的进程的组身份

ServerAdmin:用于设置Apache2服务器管理员的E-mail地址,可通过此E-mail地址及时联系Apache服务器的管理员。

ServerName:用于设置Apache服务器的完整主机名

DocumentRoot:用于设置网业文档的在系统中的实际路径。

DirectoryIndex:用于设置网站的默认索引页(首页)

ErrorLog:用于设置错误日志文件的路径和文件名,默认设置为:/logs/error_log

LogLevel:用于设置记录日志的级别,默认为Warm(警告)

CustmoLog:用于设置Apache服务器的访问日志文件的路径和格式类型。

PidFile:用于保存httpd服务器的程序进程号(PID)的文件,默认设置为/logs/httpd.pid

Timeout:用于设置Web服务器与浏览器之间网络连接的超时秒数,默认为300秒

KeepAlive:用于设置是否使用保持连接功能,设置为ON时,将提高服务器响传输文件的效率

MaxKeepAliveRequests:用于设置客户端每次连接允许请求响应的最大文件个数,默认为100个

KeepAliveTimeout:用于设置保持连接的超时秒数,默认是15秒

Include:用于包含另一个配置文件的内容,可以将实现一些特殊功能的配置单独放到一个文件里,再使用Include配置项包含到httpd.conf主配置文件中来,便于独立维护

编译安装apache

1、关闭防火墙

[root@s2

~]# service iptables stop

2、查看IP

[root@s2

~]# ifconfig eth0

eth0 Link encap:Ethernet HWaddr

00:0C:29:C5:EC:AC

inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0

3、查看主机名

[root@s2

~]# hostname

s2.benet.com

4 卸载httpd

,并且将源码包解压

rpm -e

httpd httpd-manual webalizer subversion mod_python mod_ssl mod_perl

php php-common mysql dovecot –nodeps

tar xzf

httpd-2.2.17.tar.gz -C

/usr/src/ //将源码包解压到了/usr/src

5、编译安装apache

[root@s2

httpd-2.2.17]# ./configure --prefix=/usr/local/httpd --enable-so

--enable-rewrite --enable-charset-lite && make &&

make install

6、查看安装的结果

[root@s2 httpd]# ls /usr/local/httpd/

bin build cgi-bin conf error htdocs icons include lib logs man manual modules

那么httpd的执行目录就在/usr/local/httpd/bin/这个目录下,但是这样我会觉得很冗余,所以用以前讲过的ln来连接

[root@s2 httpd]# ln -s /usr/local/httpd/bin/*

/usr/local/bin/

[root@s2 /]#httpd -v

7、添加服务,添加服务识别配置

[root@s2 /]# cp

/usr/local/httpd/bin/apachectl /etc/init.d/httpd

Vi

/et c/init.d/httpd

#chkconfig: 35 85 15

#description: httpd start server

[root@s2 /]# chkconfig --add httpd

[root@s2 /]# chkconfig --list httpd

httpd 0:关闭1:关闭2:关闭3:启用4:关闭5:启用6:关闭

[root@s2 /]# chkconfig --level 35 httpd

on

[root@s2 /]#

8 如果你是基于dns做的,那么可以添加域名

Vi

/usr/local/httpd/conf/httpd.conf

ServerName www.benet.com:80

检查httpd的语法错误

[root@s2 /]# /usr/local/httpd/bin/apachectl

-t

Syntax

OK

9

启动httpd服务

/etc/init.d/httpd start

验证是否开启服务

[root@s2 /]# netstat -natp | grep

httpd

tcp 0 0

:::80 :::* LISTEN 29040/httpd

10

测试时候成功

本机测试

blog_14175c34d0102vdzs.html

Xp远程测试(是建立在域名访问)

blog_14175c34d0102vdzs.html

使用awstats分析日志

1、解压并释放awstats软件包,执行目录中的awstats_confirure.pl脚步进行安装

[root@s2

/]# unzip awstats-7.0.zip

[root@s2

/]# mv awstats-7.0 /usr/local/awstats

[root@s2

tools]# cd /usr/local/awstats/tools/

[root@s2

tools]# ./awstats_configure.pl

-----

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 //这个是apache的主配置文件路径

----->

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 //设置日志类型默认y

Add 'Alias /awstatsclasses

"/usr/local/awstats/wwwroot/classes/"'

Add 'Alias /awstatscss

"/usr/local/awstats/wwwroot/css/"'

Add 'Alias /awstatsicons

"/usr/local/awstats/wwwroot/icon/"'

Add 'ScriptAlias /awstats/

"/usr/local/awstats/wwwroot/cgi-bin/"'

Add '' directive

AWStats directives added to Apache

config file.

----->

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 //设置站点配置文件,

----->

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 //你要统计网站的名称

----->

Define config file path

In which

directory do you plan to store your config file(s) ?

Default:

/etc/awstats

Directory

path to store config file(s) (Enter for default):

>

以后的内容直接回车就可以完成配置了

2、修改awstats.www.benet.conf的配置文件

[root@s2

tools]# vi /etc/awstats/awstats.www.benet.com.conf

第51行,修改日志保存的位置

LogFile="/usr/local/httpd/logs/access_log"

3、创建数据库的存放目录,并更新数据库

[root@s2

tools]# mkdir /var/lib/awstats

[root@s2

tools]#

/usr/local/awstats/tools/awstats_updateall.pl //执行更新脚本,重新读取刚才设置的日志路径

Running

'"/usr/local/awstats/wwwroot/cgi-bin/awstats.pl" -update

-config=www.benet.com -configdir="/etc/awstats"' to update config

www.benet.com

Create/Update database for config

"/etc/awstats/awstats.www.benet.com.conf" by AWStats version 7.0

(build 1.971)

From data

in log file "/usr/local/httpd/logs/access_log"...

Phase 1 :

First bypass old records, searching new record...

Searching

new records from beginning of log file...

Jumped

lines in file: 0

Parsed

lines in file: 2

Found 0 dropped records,

Found 0 comments,

Found 0 blank records,

Found 2 corrupted records,

Found 0 old records,

Found 0 new qualified records.

4、写入周期性计划任务,定期统计

[root@s2

tools]# crontab -l

0 0 * * 1

/usr/local/awstats/tools/awstats_updateall.pl

now

写入周期性计划任务

[root@s2

tools]#

5、访问测试

[root@s2 awstats]# /etc/init.d/httpd

restart

重启一下httpd服务

blog_14175c34d0102vdzs.html

6、做网站的授权访问

编辑httpd.conf配置文件,查找关于awstats的目录区域设置,添加认证授权设置

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny

from all

AuthName "AWSTATS"

AuthType Basic

AuthUserFile /usr/local/awstats/wwwroot/.htpasswd

require valid-user

AuthName:定义受保护的领域名称,将在弹出的认证登陆对话框中显示

AuthType:设置认证的类型,Basic为基本认证

AuthUserFile:设置用于保存用户账号、密码的认证文件路径

require

valid-user :授权给认证文件中的所有有效用户。

创建存储认证用户及账号口令的文件

[root@s2

~]# cd /usr/local/httpd/bin/

[root@s2

bin]# ./htpasswd -c

/usr/local/awstats/wwwroot/.htpasswd wode

New

password:

Re-type

new password:

Adding

password for user wode

、重启httpd服务

[root@s2 ~]# /etc/init.d/httpd restart

结果:

blog_14175c34d0102vdzs.html

blog_14175c34d0102vdzs.html

blog_14175c34d0102vdzs.html

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值