apache http.conf配置文件中,
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
##
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. [email protected]
#
ServerAdmin [email protected]#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80#
# 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 "D:/Apache2/htdocs"
DocumentRoot "E:/htdocs/php"我想增加虚拟配置文件在 extra/httpd-vhosts.conf 中,我在apache配置中 增加了 Include extra/httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot "E:/htdocs/php"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>结果报错,apache 启动不了
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
##
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. [email protected]
#
ServerAdmin [email protected]#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName localhost:80#
# 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 "D:/Apache2/htdocs"
DocumentRoot "E:/htdocs/php"我想增加虚拟配置文件在 extra/httpd-vhosts.conf 中,我在apache配置中 增加了 Include extra/httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot "E:/htdocs/php"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/dummy-host.localhost-error.log"
CustomLog "logs/dummy-host.localhost-access.log" common
</VirtualHost>结果报错,apache 启动不了
2、vhost模塊要開啟,叫mod_vhost_***啥的忘記了 你自己看下配置文件
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule php5_module D:\php\php5apache2_2.dll
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User daemon
Group daemon</IfModule>
</IfModule>修改过的文件
#Include extra/httpd-vhosts.conf
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:8090>
ServerName localhost
CustomLog "|/usr/local/sbin/cronolog /home/asc/apache2/logs/access-%Y-%m-%d.log" combined
ErrorLog "|/usr/local/sbin/cronolog /home/asc/apache2/logs/error-%Y-%m-%d.log"
DocumentRoot "E:/htdocs/php"
DirectoryIndex errorindex.html index.php main.php index.htm index.html <Directory "E:/htdocs/php">
Options FollowSymLinks Indexes
Order Deny,Allow
#Deny from all
Allow from all
</Directory> <Location ~ "/(api)/">
Options None
Order allow,deny
Allow from all
</Location>
</VirtualHost>
发现在apache文件中一旦 加上 Include extra/httpd-vhosts.conf,apache就不能启动了???