Apache 学习笔记

来源:互联网 发布:java程序代码及结果 编辑:程序博客网 时间:2024/05/20 17:07

命令节

1.安装apache服务:

d:\apache2.4\Apache24\bin\httpd -k install

2.停止apache服务:

d:\\apache2.4\Apache24\bin\httpd -k uninstall -n apache2.4

3.启动apache服务:

d:\Software\phptools\apache2.4\Apache24\bin\httpd.exe -w -n "Apache2.4" -k start


配置节

1.配置虚拟目录

从httpd.conf中找到“<IfModule alias_module>”,在其中加入以下代码:

    Alias /DemoSite "D:/AppServ/www2"
    <Directory "D:/AppServ/www2">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>

整个<IfModule alias_module>如下:

<IfModule alias_module>
    #
    # Redirect: Allows you to tell clients about documents that used to 
    # exist in your server's namespace, but do not anymore. The client 
    # will make a new request for the document at its new location.
    # Example:
    # Redirect permanent /foo http://www.example.com/bar


    #
    # Alias: Maps web paths into filesystem paths and is used to
    # access content that does not live under the DocumentRoot.
    # Example:
    # Alias /webpath /full/filesystem/path
    #
    # If you include a trailing / on /webpath then the server will
    # require it to be present in the URL.  You will also likely
    # need to provide a <Directory> section to allow access to
    # the filesystem path.


    #
    # ScriptAlias: This controls which directories contain server scripts. 
    # ScriptAliases are essentially the same as Aliases, except that
    # documents in the target directory are treated as applications and
    # run by the server when requested rather than as documents sent to the
    # client.  The same rules about trailing "/" apply to ScriptAlias
    # directives as to Alias.
    #
    ScriptAlias /cgi-bin/ "D:/Software/phptools/apache2.4/Apache24/cgi-bin/"
    Alias /DemoSite "D:/AppServ/www2"
    <Directory "D:/AppServ/www2">
        Options Indexes FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>

站点为“DemoSite”,虚拟路径为“D:/AppServ/www2”。

重启Apache,则会报错,是因为访问权限问题,添加以下配置即可解决。

找到<Directory />节点,在其中加入如下内容:

    Options FollowSymLinks
    AllowOverride None
    Order deny,allow

    Allow from all

    Satisfy all

<Directory />节点的配置如下:

<Directory />
#    AllowOverride none
#    Require all denied
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
#   Deny from all
    Allow from all


#允许所有访问
    Satisfy all
</Directory>

或者找到<Directory "path">配置项,将其中的“Allow from IP”注释掉即可。

继续完善。。。。。。

0 0
原创粉丝点击