/ 中存储网

Linux系统中Apache服务器配置方法

2014-03-11 13:17:01 来源:itjs.cn
步骤一 检查是否安装了Apache服务

[[email protected]  ~]# rpm -qa|grep httpd

httpd-manual-2.0.54-10

system-config-httpd-1.3.2-2

httpd-devel-2.0.54-10

httpd-2.0.54-10

步骤二 创建网页 apache.html

[[email protected] ~]#vi /var/www/apache.html

步骤三 打开主配置文件并加以修改

[[email protected] ~]#vi /etc/httpd/conf/httpd.conf

#

# Listen: Allows you to bind Apache to specific IP addresses and/or

# ports, in addition to the default. See also the <VirtualHost>

# directive.

#

# Change this to Listen on specific IP addresses as shown below to

# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)

#

#Listen 12.34.56.78:80

Listen 80

Listen 8888                   #添加端口号8888

Listen 6666

#

# DirectoryIndex: sets the file that Apache will serve if a directory

# is requested.

#

# The index.html.var file (a type-map) is used to deliver content-

# negotiated documents.  The MultiViews Option can be used for the

# same purpose, but it is much slower.

#

DirectoryIndex index.html index.html.var apache.html     #指定主目录

# AccessFileName: The name of the file to look for in each directory

# for additional configuration directives.  See also the AllowOverride

# directive.

#

# VirtualHost example:

# Almost any Apache directive may go into a VirtualHost container.

# The first VirtualHost section is used for requests without a known

# server name.

#

#<VirtualHost *:80>

#    DocumentRoot /www/docs/dummy-host.example.com

#    ServerName dummy-host.example.com

#    ErrorLog logs/dummy-host.example.com-error_log

#    CustomLog logs/dummy-host.example.com-access_log common

#</VirtualHost>

<VirtualHost 192.168.1.254:8888>   #IP-besed

DocumentRoot /var/www                     #虚拟目录路径

路径

</VirtualHost>

 步骤四 启动服务器

[[email protected] ~]#service httpd start