首页
登录 | 注册

Apache安装与设置

安装Apache
[root@linux ~]# yum -y install httpd ← 安装httpd
Setting up Install Process
Setting up repositories
dag 100% |=========================| 1.1 kB 00:00
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Excluding Packages in global exclude list
Finished
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for httpd to pack into transaction set.
httpd-2.0.52-19.ent.cento 100% |=========================| 61 kB 00:00
---> Package httpd.i386 0:2.0.52-19.ent.centos4 set to be updated
--> Running transaction check
--> Processing Dependency: libaprutil-0.so.0 for package: httpd
--> Processing Dependency: httpd-suexec for package: httpd
--> Processing Dependency: libapr-0.so.0 for package: httpd
--> Processing Dependency: apr >= 0.9.4-24.2 for package: httpd
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for httpd-suexec to pack into transaction set.
httpd-suexec-2.0.52-19.en 100% |=========================| 21 kB 00:00
---> Package httpd-suexec.i386 0:2.0.52-19.ent.centos4 set to be updated
---> Downloading header for apr to pack into transaction set.
apr-0.9.4-24.5.i386.rpm 100% |=========================| 7.4 kB 00:00
---> Package apr.i386 0:0.9.4-24.5 set to be updated
---> Downloading header for apr-util to pack into transaction set.
apr-util-0.9.4-21.i386.rp 100% |=========================| 5.2 kB 00:00
---> Package apr-util.i386 0:0.9.4-21 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
httpd i386 2.0.52-19.ent.centos4 base 886 k
Installing for dependencies:
apr i386 0.9.4-24.5 base 88 k
apr-util i386 0.9.4-21 base 51 k
httpd-suexec i386 2.0.52-19.ent.centos4 base 27 k

Transaction Summary
=============================================================================
Install 4 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.0 M
Downloading Packages:
(1/4): httpd-suexec-2.0.5 100% |=========================| 27 kB 00:00
(2/4): apr-0.9.4-24.5.i38 100% |=========================| 88 kB 00:00
(3/4): apr-util-0.9.4-21. 100% |=========================| 51 kB 00:00
(4/4): httpd-2.0.52-19.en 100% |=========================| 886 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: apr ######################### [1/4]
Installing: apr-util ######################### [2/4]
Installing: httpd ######################### [3/4]
Installing: httpd-suexec ######################### [4/4]

Installed: httpd.i386 0:2.0.52-19.ent.centos4
Dependency Installed: apr.i386 0:0.9.4-24.5 apr-util.i386 0:0.9.4-21 httpd-suexec.i386 0:2.0.52-19.ent.centos4
Complete!

[root@linux ~]# yum -y install php
 ← 安装php
Setting up Install Process
Setting up repositories
dag 100% |=========================| 1.1 kB 00:00
update 100% |=========================| 951 B 00:00
base 100% |=========================| 1.1 kB 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Excluding Packages in global exclude list
Finished
Reducing Dag RPM Repository for Red Hat Enterprise Linux to included packages only
Finished
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php to pack into transaction set.
php-4.3.9-3.9.i386.rpm 100% |=========================| 22 kB 00:00
---> Package php.i386 0:4.3.9-3.9 set to be updated
--> Running transaction check
--> Processing Dependency: php-pear for package: php
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for php-pear to pack into transaction set.
php-pear-4.3.9-3.9.i386.r 100% |=========================| 32 kB 00:00
---> Package php-pear.i386 0:4.3.9-3.9 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
php i386 4.3.9-3.9 update 1.3 M
Installing for dependencies:
php-pear i386 4.3.9-3.9 update 265 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 1.6 M
Downloading Packages:
(1/2): php-pear-4.3.9-3.9 100% |=========================| 265 kB 00:00
(2/2): php-4.3.9-3.9.i386 100% |=========================| 1.3 MB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: php ######################### [1/2]
Installing: php-pear ######################### [2/2]

Installed: php.i386 0:4.3.9-3.9
Dependency Installed: php-pear.i386 0:4.3.9-3.9
Complete!

WEB服务器的设置

[root@linux ~]# vi /etc/httpd/conf/httpd.conf ← 编辑httpd的设定文件
ServerTokens OS

ServerTokens Prod
 ← 系统名称不表示

ServerAdmin root@localhost

ServerAdmin koku@aoiday.com
 ← 设置管理员邮件地址

#ServerName www.example.com:80

ServerName aoiday.com:80
 ← 设置服务器名称



#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
  ↓
Options Includes ExecCGI FollowSymLinks
 ← 允许CGI,SSI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None
  ↓
AllowOverride All
 ← 允许.htaccess

#
# 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 \"%!414r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
 
↑ 不记录过长的URI(414错误)

#
# For a single logfile with access, agent, and referer information
# (Combined Logfile Format), use the following directive:
#
SetEnvIf Request_URI "default\.ida" no_log
 ← 追加(从worm的访问不记录)
SetEnvIf Request_URI "cmd\.exe" no_log
 ← 〃
SetEnvIf Request_URI "root\.exe" no_log
 ← 〃
SetEnvIf Request_URI "Admin\.dll" no_log
 ← 〃
SetEnvIf Request_URI "NULL\.IDA" no_log
 ← 〃
SetEnvIf Remote_Addr 192.168.1 no_log
 ← 追加(内部访问不记录)
CustomLog logs/access_log combined
env=!no_log ← 记录上述以外的访问

ServerSignature On

ServerSignature Off
 ← 不显示Apache的版本号

AddDefaultCharset UTF-8

#AddDefaultCharset UTF-8 ← 添加#

#AddHandler cgi-script .cgi

AddHandler cgi-script .cgi
.pl ← 追加.pl


Options Indexes MultiViews

Options MultiViews
 ← 禁止浏览文件
AllowOverride None
Order allow,deny
Allow from all


[root@linux ~]# rm -f /etc/httpd/conf.d/welcome.conf
 ← 删除

[root@linux ~]# rm -f /var/www/error/noindex.html
 ← 删除

WEB服务器的根目录所有者变更

[root@linux ~]# chown centos. /var/www/html/ ← WEB服务器的根目录所有者变更为用户centos

[root@linux ~]# ll /var/www/ 
← 确认
合計 24
drwxr-xr-x 2 root root 4096 10 5 11:45 cgi-bin
drwxr-xr-x 3 root root 4096 10 9 00:19 error
drwxr-xr-x 5
centos centos 4096 9 27 17:43 html
drwxr-xr-x 3 root root 4096 9 27 09:29 icons

启动http

[root@linux ~]# /etc/rc.d/init.d/httpd start ← httpd启动
httpd startting: [ OK ]

[root@linux ~]# chkconfig httpd on 
← httpd自動起動設定

[root@linux ~]# chkconfig --list httpd 
← 设置httpd开机自动启动
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off 
← 确认2~5为on


本文引用地址:http://www.aoiday.com/article/2006/0702/article_3.shtml


相关文章

  • Codis安装部署全架构
    Codis安装部署全架构 Codis 是一个分布式 Redis 解决方案, 对于上层的应用来说, 连接到 Codis Proxy 和连接原生的 Redis Server 没有明显的区别 (不支持的命令列表), 上层应用可以像使用单机的 Re ...
  • BetterJS安装及配置 介绍 公司开发同事需要用这个,所以直接安装配置好,顺便学习下:) BadJS 是 web 前端脚本错误监控及跟踪解决方案.此项目为鹅厂 imweb(qq群:179045421) 团队的开源项目. 安装 宿主机环境 ...
  • 构建Xamarin.Forms NuGet
    探索Xamarin.Forms(并在代码中变得更加舒适)的一个很好的方法是克隆存储库并运行它,特别是任何ControlGallery项目. 我们知道您中有许多人已经做到了这一点,所以您可以采取的下一步是为XAMarin.Forms进行自己的 ...
  • 所需的软件:  FSUpthreads-3.5-VOLS.tar  gcc-2.95.2-VOLS.tar  Glib-1.5-VOLS.tar  gzip-1.2.4-VOLS.tar  make-3.78.1-VOLS.tar  zli ...
  • subversion for linux的安装(SVN+apache+linux)
          1.  软件环境 1. 版本 软件 版本 说明 Linux redhat 2.6.9-5.EL  APR APR-1.2.12 Apache可移植运行库 APR-util APR-util-1.2.12  Apache http ...
  • CentOS 6.6安装配置LAMP服务器(Apache+PHP5+MySQL)方法步骤
    CentOS 6.6系统安装配置图解教程 //www.iis7.com/os/239738.html vi /etc/sysconfig/iptables-A INPUT -m state --state NEW -m tcp -p tcp ...

2020 unjeep.com webmaster#unjeep.com
12 q. 0.014 s.
京ICP备10005923号