Apacheのインストールと構成

15950 ワード


   Apache

1、    
Apache          ,    。     ,         。      :
C:\Program Files\Apache Group\Apache\conf\httpd.conf
     Apache   ,             (     )        。      , “#”        。
  :               。

2、    
             :
#Listen 3000
#Listen 12.34.56.78:80
Apache IP     。         ,Apache        IP   80   。
Port 80
Apache   。    80。

ServerName abc.meibu.com
Web      。      “Server Name”       。

DocumentRoot "C:/Program Files/Apache Group/Apache/htdocs"
        。            “D:\myweb”   ,   DocumentRoot        “D:/myweb”。

Options Indexes FollowSymLinks MultiViews
      ,     “Indexes”  。                  。

DirectoryIndex index.html
       。           (  http:// abc.meibu.com/)   ,Apache              。      
        ,      。

ScriptAlias /cgi-bin/ "C:/Program Files/Apache Group/Apache/cgi-bin/"
CGI      。

    

1、      

           :
<IfModule mod_alias.c>
           :
Alias /vdir/ "c:/comexe/"
<Directory "c:/comexe/">
Options MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>

  ,     http:// abc.meibu.com/vdir/,      c:\comexe\      。

Apache           :“/icons/” “/manual/”。          ,          。

2.        
	         ,    ip(127.0.0.1 localhost)    ,      。    apache     ip       。
	  : 127   ip         ,         ip          。
	/apache2.2/conf/httpd.conf  

1、Listen , , ip , :

Listen 80

2、 “NameVirtualHost”。

3、 : httpd.conf

<VirtualHost 127.0.0.2:80>
    DocumentRoot d:/AppServ/www2
    ServerName 127.0.0.2:80
</VirtualHost>

<VirtualHost 127.0.0.3:80>
    DocumentRoot d:/AppServ/www3
    ServerName 127.0.0.3:80
</VirtualHost>

...

4、然后相应的配置好各个目录属性,下面是一个目录属性的典型配置:

<Directory "d:/AppServ/www2">
    Options Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order Allow,Deny
    Allow from all
</Directory>

<Directory "d:/AppServ/www3">
    Options Indexes FollowSymLinks Multiviews
    AllowOverride All
    Order Allow,Deny
    Allow from all
</Directory>

常见问题 1、如何解决中文网页显示乱码 在配置文件中找包含“Addlanguage”或“AddCharset”的行,在这些行最前面增加一行: AddDefaultCharset GB2312 养成良好的习惯,在每个网页的<head></head>里加入这行: <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> 一般的中文版网页编辑工具(例如FrontPage、Dreamweaver等)都会自动加上这行。 2、如何解决中文文件名无法访问 在ie中选择 工具 -> internet选项 -> 高级 -> 取消“总是以UTF-8发送URL”。 这个方法很麻烦,请尽量不要使用中文的网站文件名。 3. 在winxp sp2下安装的apache+php5+mysql5,其他电脑无法正常访问我们的网站!出现如下错误: Forbidden You don't have permission to access / on this server. 这个错误的原因是,用户没有权限访问你的网站目录。 解决办法: 打开的apache的配置文件:httpd.conf 在末尾添加如下代码:yourpath你的网站目录 <Directory "d:/yourpath/"> Allow from all </Directory> 保存之后,记得重启apache服务,问题就解决了。

4.  :“(OS 10013)                         。 : make_sock: could not bind to address 0.0.0.0:80”    
    :   80        , /apache2.2/conf/httpd.conf      80  81  .     81   ,eg:
http://localhost:81/ http://127.0.0.1:81/
5.  :       ,    
    :  apache;      apache  ,     ,  >services.msc>  Apache2.2  。
   :
1.Apache            :             。                    ,          
      ,          。
2.         ,     Apache    。
http://www.vvschool.cn/html/web/exchange/2010/0828/4245.html
http://blog.sina.com.cn/s/blog_830efbea0100y4e7.html
http://zhidao.baidu.com/question/68617752.html