zoukankan      html  css  js  c++  java
  • Apache下的配置文件httpd.conf、httpdvhosts.conf(windows),Apache配置虚拟主机,文件可以不用在www文件夹下面

    httpd.conf文件一般存在于apache目录下的conf文件夹中,主要用来配置apache的
    http.conf里面的配置介绍:

    1、Listen :监听端口,默认情况是80。
    2、ServerAdmin :服务器管理员邮箱。
    3、ServerName:服务名。
    4、DocumentRoot:PHP网站的路径。
    5、<Directory />
        Options FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
      </Directory>
    Apache访问的每个目录可设置相关的服务和特性是允许或(和)不允许。
    一般修改为,否则可能会出现403页面错误。
    <Directory />
        Options FollowSymLinks
        AllowOverride None
      </Directory>

    同时修改PHP的目录:
    修改DocumentRoot和<Directory "D:/Program Files/xampp/htdocs">。
    修改为PHP的网站所在的目录,如下所示:
     
    查看问题的方法:
    运行dos,输入“cd  /d  F:/xampplite/apache/bin” ,进入到xampp的bin目录,输入httpd.exe就可以查看错误。
    常见问题
    1、ServerRoot没配置好,可以使用绝对路径
    2、document没配置好,网站路径没配置好
    3、httpd-vhosts.conf没配置好,配置参考如下

    <VirtualHost *:80>
        ServerName   localhost
        DocumentRoot  F:/Web/public

        RewriteEngine off

        <Location />
            RewriteEngine on
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule !\.(js|ico|gif|jpg|png|css)$ /index.php
        </Location>
       
        <Directory F:/xampplite/htdocs>
            Options Indexes FollowSymLinks
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
       
    </VirtualHost>
    如果没有权限的话,在httpd.conf还增加一个:

    <Directory "F:/同步文件夹/百度云同步盘/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted
    </Directory>

    转自:http://blog.sina.com.cn/s/blog_6721f25c0100m3yy.html
     
     
     
    快速配置虚拟主机
     httpd.conf不用改,
     
    里的virtulhost 80一定要和httpd.conf里面的端口一样,不然打不开。
     
     如果配置的DocumentRoot不在F:/xampp/htdocs下面,打开会出现:

    xampp:Access forbidden!You don't have permission to access the requested directory.

    修改httpd-vhosts.conf的配置如下:

     
    1. <VirtualHost *:80>  
    2.     DocumentRoot "D:/workspace/hush-framework/hush-app/web/frontend"  
    3.     ServerName hush-app-frontend  
    4.     <Directory  "D:/workspace/hush-framework/hush-app/web/frontend"   >  
    5.         AllowOverride All  
    6.         Order allow ,deny
    7.         Allow from all  
    8.     Require all granted  
    9.     </Directory>  
    10. </VirtualHost>  
     

    Require all granted

    允许所有请求访问资源

     
     
     

    允许所有访问

    Require all granted

    拒绝所有访问

    Require all denied

     
     
     
     
     
     
     
     
     
  • 相关阅读:
    tinyhttp源码阅读(注释)
    BSON 1.0版本规范(翻译)
    linux下编译qt5.6.0静态库——configure配置
    springboot(二):web综合开发
    Linux 4.10中两个新特性与我的一段故事
    [Perforce]password (P4PASSWD) invalid or unset. 的错误解决
    Cross compiling coreutils and generate the manpages
    【蓝桥杯】PREV-21 回文数字
    【Qt】StackedWidget
    凡人视角C++之string(上)
  • 原文地址:https://www.cnblogs.com/youxin/p/3097760.html
Copyright © 2011-2022 走看看