linux搭建乐网服务器,教你linux搭建web服务器

在我本机配置时间不长,不过花了好长的时间写了份配置文档,和大家分享一下,希望对大家有用

LINUX发行版本:Fedora 14 , Apache .2.2

安装就不说了!依然采用rpm包安装方式 ,下面进入正题:

httpd.conf配置文件介绍

1、与Apache网络和系统相关的选项

#使用ServerRoot参数设置Apache安装目录

# ServerRoot: The top of the directory tree under which the server's

# configuraTIon, error, and log files are kept.

# you will save yourself a lot of trouble.

# Do NOT add a slash at the end of the directory path.

#

ServerRoot "/etc/httpd"

#使用Listen参数设置Apache监听端口,Apache默认是80

Listen 80

#使用User参数设置Apache进程的执行者

User apache

#使用Group参数设置Apache进程执行者所属的用户组

Group apache

#使用ServerAdmin参数设置网站管理员的邮箱地址

2、与Apache文件和目录权限相关选项

#使用DocumentRoot参数设置网站根目录

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locaTIons.

#

DocumentRoot "/var/www/html"

#使用Directory段设置根目录权限

OpTIons FollowSymLinks

AllowOverride None

#使用Directory段设置/var/www/html目录权限

OpTIons Indexes FollowSymLinks

AllowOverride None

Order allow,deny

Allow from all

#设置首页为index.html

DirectoryIndex index.html index.html.var

#.ht后缀文件的访问权限控制与上目录的AllowOverride一起作用

# The following lines prevent .htaccess and .htpasswd files from being

# viewed by Web clients.

#

Order allow,deny

Deny from all

Satisfy All

3、与Apache日志相关的选项如下

#使用ErrorLog参数设置错误日志的位置

# ErrorLog: The location of the error log file.

# If you do not specify an ErrorLog directive within a

# container, error messages relating to that virtual host will be

# logged here. If you *do* define an error logfile for a

# container, that host's errors will be logged there and not here.

#

ErrorLog logs/error_log

#使用LogLevel参数设置错误日志的级别

# LogLevel: Control the number of messages logged to the error_log.

# Possible values include: debug, info, notice, warn, error, crit,

# alert, emerg.

#

LogLevel warn

#使用LogFormat参数设置访问日志的格式模板

# The following directives define some format nicknames for use with

# a CustomLog directive (see below).

#

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

#使用CustomLog参数设置访问日志的格式模板

# For a single logfile with access, agent, and referer information

# (Combined Logfile Format), use the following directive:

#

CustomLog logs/access_log combined

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值