Apache下的配置文件httpd.conf、httpd-vhosts.conf 转

Apache下的配置文件httpd.conf、httpd-vhosts.conf(windows)

2013-05-24 22:09 by youxin, 58 阅读, 0 评论, 收藏, 编辑

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
原文地址:https://www.cnblogs.com/zhang36/p/4931567.html