免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2854 | 回复: 3
打印 上一主题 下一主题

[Web] 很奇怪的问题apache不能支持.htaccess文件了 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-19 00:48 |只看该作者 |倒序浏览
我都正常的配置。并装了一个论坛。根目录下面放了一个.htaccess文件。弄死就是不支持。请大家帮我看看


freebsd + apache-2.2.14

httpd.conf
  1. #
  2. # This is the main Apache HTTP server configuration file.  It contains the
  3. # configuration directives that give the server its instructions.
  4. # See <URL:[url]http://httpd.apache.org/docs/2.2[/url]> for detailed information.
  5. # In particular, see
  6. # <URL:[url]http://httpd.apache.org/docs/2.2/mod/directives.html[/url]>
  7. # for a discussion of each configuration directive.
  8. #
  9. # Do NOT simply read the instructions in here without understanding
  10. # what they do.  They're here only as hints or reminders.  If you are unsure
  11. # consult the online docs. You have been warned.  
  12. #
  13. # Configuration and logfile names: If the filenames you specify for many
  14. # of the server's control files begin with "/" (or "drive:/" for Win32), the
  15. # server will use that explicit path.  If the filenames do *not* begin
  16. # with "/", the value of ServerRoot is prepended -- so "logs/foo_log"
  17. # with ServerRoot set to "/usr/local/httpd" will be interpreted by the
  18. # server as "/usr/local/httpd/logs/foo_log".

  19. #
  20. # ServerRoot: The top of the directory tree under which the server's
  21. # configuration, error, and log files are kept.
  22. #
  23. # Do not add a slash at the end of the directory path.  If you point
  24. # ServerRoot at a non-local disk, be sure to point the LockFile directive
  25. # at a local disk.  If you wish to share the same ServerRoot for multiple
  26. # httpd daemons, you will need to change at least LockFile and PidFile.
  27. #
  28. ServerRoot "/usr/local/httpd"

  29. #
  30. # Listen: Allows you to bind Apache to specific IP addresses and/or
  31. # ports, instead of the default. See also the <VirtualHost>
  32. # directive.
  33. #
  34. # Change this to Listen on specific IP addresses as shown below to
  35. # prevent Apache from glomming onto all bound IP addresses.
  36. #
  37. #Listen 12.34.56.78:80
  38. Listen 80

  39. #
  40. # Dynamic Shared Object (DSO) Support
  41. #
  42. # To be able to use the functionality of a module which was built as a DSO you
  43. # have to place corresponding `LoadModule' lines at this location so the
  44. # directives contained in it are actually available _before_ they are used.
  45. # Statically compiled modules (those listed by `httpd -l') do not need
  46. # to be loaded here.
  47. #
  48. # Example:
  49. # LoadModule foo_module modules/mod_foo.so
  50. LoadModule php5_module        modules/libphp5.so

  51. #

  52. <IfModule !mpm_netware_module>
  53. <IfModule !mpm_winnt_module>
  54. #
  55. # If you wish httpd to run as a different user or group, you must run
  56. # httpd as root initially and it will switch.  
  57. #
  58. # User/Group: The name (or #number) of the user/group to run httpd as.
  59. # It is usually good practice to create a dedicated user and group for
  60. # running httpd, as with most system services.
  61. #
  62. User daemon
  63. Group daemon

  64. </IfModule>
  65. </IfModule>

  66. # 'Main' server configuration
  67. #
  68. # The directives in this section set up the values used by the 'main'
  69. # server, which responds to any requests that aren't handled by a
  70. # <VirtualHost> definition.  These values also provide defaults for
  71. # any <VirtualHost> containers you may define later in the file.
  72. #
  73. # All of these directives may appear inside <VirtualHost> containers,
  74. # in which case these default settings will be overridden for the
  75. # virtual host being defined.
  76. #

  77. #
  78. # ServerAdmin: Your address, where problems with the server should be
  79. # e-mailed.  This address appears on some server-generated pages, such
  80. # as error documents.  e.g. [email]admin@your-domain.com[/email]
  81. #
  82. ServerAdmin [email]you@example.com[/email]

  83. #
  84. # ServerName gives the name and port that the server uses to identify itself.
  85. # This can often be determined automatically, but we recommend you specify
  86. # it explicitly to prevent problems during startup.
  87. #
  88. # If your host doesn't have a registered DNS name, enter its IP address here.
  89. #
  90. #ServerName [url]www.example.com:80[/url]

  91. #
  92. # DocumentRoot: The directory out of which you will serve your
  93. # documents. By default, all requests are taken from this directory, but
  94. # symbolic links and aliases may be used to point to other locations.
  95. #
  96. DocumentRoot "/usr/local/httpd/htdocs"

  97. #
  98. # Each directory to which Apache has access can be configured with respect
  99. # to which services and features are allowed and/or disabled in that
  100. # directory (and its subdirectories).
  101. #
  102. # First, we configure the "default" to be a very restrictive set of
  103. # features.  
  104. #
  105. <Directory />
  106.     Options FollowSymLinks
  107.     AllowOverride All
  108.     Order deny,allow
  109.     Allow from all
  110. </Directory>

  111. #
  112. # Note that from this point forward you must specifically allow
  113. # particular features to be enabled - so if something's not working as
  114. # you might expect, make sure that you have specifically enabled it
  115. # below.
  116. #

  117. #
  118. # This should be changed to whatever you set DocumentRoot to.
  119. #
  120. <Directory "/usr/local/httpd/htdocs/xyz.com">
  121.     #
  122.     # Possible values for the Options directive are "None", "All",
  123.     # or any combination of:
  124.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  125.     #
  126.     # Note that "MultiViews" must be named *explicitly* --- "Options All"
  127.     # doesn't give it to you.
  128.     #
  129.     # The Options directive is both complicated and important.  Please see
  130.     # [url]http://httpd.apache.org/docs/2.2/mod/core.html#options[/url]
  131.     # for more information.
  132.     #
  133.     Options Indexes FollowSymLinks

  134.     #
  135.     # AllowOverride controls what directives may be placed in .htaccess files.
  136.     # It can be "All", "None", or any combination of the keywords:
  137.     #   Options FileInfo AuthConfig Limit
  138.     #
  139.     AllowOverride All

  140.     #
  141.     # Controls who can get stuff from this server.
  142.     #
  143.     Order allow,deny
  144.     Allow from all

  145. </Directory>

  146. #
  147. # DirectoryIndex: sets the file that Apache will serve if a directory
  148. # is requested.
  149. #
  150. <IfModule dir_module>
  151.     DirectoryIndex index.html
  152. </IfModule>

  153. #
  154. # The following lines prevent .htaccess and .htpasswd files from being
  155. # viewed by Web clients.
  156. #
  157. <FilesMatch "^\.ht">
  158.     Order allow,deny
  159.     Deny from all
  160.     Satisfy All
  161. </FilesMatch>

  162. #
  163. # ErrorLog: The location of the error log file.
  164. # If you do not specify an ErrorLog directive within a <VirtualHost>
  165. # container, error messages relating to that virtual host will be
  166. # logged here.  If you *do* define an error logfile for a <VirtualHost>
  167. # container, that host's errors will be logged there and not here.
  168. #
  169. ErrorLog "logs/error_log"

  170. #
  171. # LogLevel: Control the number of messages logged to the error_log.
  172. # Possible values include: debug, info, notice, warn, error, crit,
  173. # alert, emerg.
  174. #
  175. LogLevel warn

  176. <IfModule log_config_module>
  177.     #
  178.     # The following directives define some format nicknames for use with
  179.     # a CustomLog directive (see below).
  180.     #
  181.     LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  182.     LogFormat "%h %l %u %t \"%r\" %>s %b" common

  183.     <IfModule logio_module>
  184.       # You need to enable mod_logio.c to use %I and %O
  185.       LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
  186.     </IfModule>

  187.     #
  188.     # The location and format of the access logfile (Common Logfile Format).
  189.     # If you do not define any access logfiles within a <VirtualHost>
  190.     # container, they will be logged here.  Contrariwise, if you *do*
  191.     # define per-<VirtualHost> access logfiles, transactions will be
  192.     # logged therein and *not* in this file.
  193.     #
  194.     CustomLog "logs/access_log" common

  195.     #
  196.     # If you prefer a logfile with access, agent, and referer information
  197.     # (Combined Logfile Format) you can use the following directive.
  198.     #
  199.     #CustomLog "logs/access_log" combined
  200. </IfModule>

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

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

  218.     #
  219.     # ScriptAlias: This controls which directories contain server scripts.
  220.     # ScriptAliases are essentially the same as Aliases, except that
  221.     # documents in the target directory are treated as applications and
  222.     # run by the server when requested rather than as documents sent to the
  223.     # client.  The same rules about trailing "/" apply to ScriptAlias
  224.     # directives as to Alias.
  225.     #
  226.     ScriptAlias /cgi-bin/ "/usr/local/httpd/cgi-bin/"

  227. </IfModule>

  228. <IfModule cgid_module>
  229.     #
  230.     # ScriptSock: On threaded servers, designate the path to the UNIX
  231.     # socket used to communicate with the CGI daemon of mod_cgid.
  232.     #
  233.     #Scriptsock logs/cgisock
  234. </IfModule>

  235. #
  236. # "/usr/local/httpd/cgi-bin" should be changed to whatever your ScriptAliased
  237. # CGI directory exists, if you have that configured.
  238. #
  239. <Directory "/usr/local/httpd/cgi-bin">
  240.     AllowOverride None
  241.     Options None
  242.     Order allow,deny
  243.     Allow from all
  244. </Directory>

  245. #
  246. # DefaultType: the default MIME type the server will use for a document
  247. # if it cannot otherwise determine one, such as from filename extensions.
  248. # If your server contains mostly text or HTML documents, "text/plain" is
  249. # a good value.  If most of your content is binary, such as applications
  250. # or images, you may want to use "application/octet-stream" instead to
  251. # keep browsers from trying to display binary files as though they are
  252. # text.
  253. #
  254. DefaultType text/plain

  255. <IfModule mime_module>
  256.     #
  257.     # TypesConfig points to the file containing the list of mappings from
  258.     # filename extension to MIME-type.
  259.     #
  260.     TypesConfig conf/mime.types

  261.     #
  262.     # AddType allows you to add to or override the MIME configuration
  263. AddType application/x-httpd-php .php
  264.     # file specified in TypesConfig for specific file types.
  265.     #
  266.     #AddType application/x-gzip .tgz
  267.     #
  268.     # AddEncoding allows you to have certain browsers uncompress
  269.     # information on the fly. Note: Not all browsers support this.
  270.     #
  271.     #AddEncoding x-compress .Z
  272.     #AddEncoding x-gzip .gz .tgz
  273.     #
  274.     # If the AddEncoding directives above are commented-out, then you
  275.     # probably should define those extensions to indicate media types:
  276.     #
  277.     AddType application/x-compress .Z
  278.     AddType application/x-gzip .gz .tgz

  279.     #
  280.     # AddHandler allows you to map certain file extensions to "handlers":
  281.     # actions unrelated to filetype. These can be either built into the server
  282.     # or added with the Action directive (see below)
  283.     #
  284.     # To use CGI scripts outside of ScriptAliased directories:
  285.     # (You will also need to add "ExecCGI" to the "Options" directive.)
  286.     #
  287.     #AddHandler cgi-script .cgi

  288.     # For type maps (negotiated resources):
  289.     #AddHandler type-map var

  290.     #
  291.     # Filters allow you to process content before it is sent to the client.
  292.     #
  293.     # To parse .shtml files for server-side includes (SSI):
  294.     # (You will also need to add "Includes" to the "Options" directive.)
  295.     #
  296.     #AddType text/html .shtml
  297.     #AddOutputFilter INCLUDES .shtml
  298. </IfModule>

  299. #
  300. # The mod_mime_magic module allows the server to use various hints from the
  301. # contents of the file itself to determine its type.  The MIMEMagicFile
  302. # directive tells the module where the hint definitions are located.
  303. #
  304. #MIMEMagicFile conf/magic

  305. #
  306. # Customizable error responses come in three flavors:
  307. # 1) plain text 2) local redirects 3) external redirects
  308. #
  309. # Some examples:
  310. #ErrorDocument 500 "The server made a boo boo."
  311. #ErrorDocument 404 /missing.html
  312. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  313. #ErrorDocument 402 [url]http://www.example.com/subscription_info.html[/url]
  314. #

  315. #
  316. # EnableMMAP and EnableSendfile: On systems that support it,
  317. # memory-mapping or the sendfile syscall is used to deliver
  318. # files.  This usually improves server performance, but must
  319. # be turned off when serving from networked-mounted
  320. # filesystems or if support for these functions is otherwise
  321. # broken on your system.
  322. #
  323. #EnableMMAP off
  324. #EnableSendfile off

  325. # Supplemental configuration
  326. #
  327. # The configuration files in the conf/extra/ directory can be
  328. # included to add extra features or to modify the default configuration of
  329. # the server, or you may simply copy their contents here and change as
  330. # necessary.

  331. # Server-pool management (MPM specific)
  332. Include conf/extra/httpd-mpm.conf

  333. # Multi-language error messages
  334. #Include conf/extra/httpd-multilang-errordoc.conf

  335. # Fancy directory listings
  336. #Include conf/extra/httpd-autoindex.conf

  337. # Language settings
  338. #Include conf/extra/httpd-languages.conf

  339. # User home directories
  340. #Include conf/extra/httpd-userdir.conf

  341. # Real-time info on requests and configuration
  342. #Include conf/extra/httpd-info.conf

  343. # Virtual hosts
  344. Include conf/extra/httpd-vhosts.conf

  345. # Local access to the Apache HTTP Server Manual
  346. #Include conf/extra/httpd-manual.conf

  347. # Distributed authoring and versioning (WebDAV)
  348. #Include conf/extra/httpd-dav.conf

  349. # Various default settings
  350. #Include conf/extra/httpd-default.conf

  351. # Secure (SSL/TLS) connections
  352. #Include conf/extra/httpd-ssl.conf
  353. #
  354. # Note: The following must must be present to support
  355. #       starting without SSL on platforms with no /dev/random equivalent
  356. #       but a statically compiled-in mod_ssl.
  357. #
  358. <IfModule ssl_module>
  359. SSLRandomSeed startup builtin
  360. SSLRandomSeed connect builtin
  361. </IfModule>
复制代码


httpd-vhosts.conf

  1. <VirtualHost *:80>
  2.         DocumentRoot "/usr/local/httpd/htdocs/xyz.com"
  3.         ServerName [url]www.xyz.com[/url]


  4. <IfModule dir_module>
  5.     DirectoryIndex index.php index.html
  6. </IfModule>

  7. <Directory /usr/local/httpd/htdocs/xyz.com>
  8. Allowoverride All
  9. </Directory>

  10.         <IfModule mpm_peruser_module>
  11.                 ServerEnvironment xyz xyz
  12.         </IfModule>
  13. </VirtualHost>
复制代码



httpd-vhosts.conf这样写也不行
  1. <VirtualHost *:80>
  2.         DocumentRoot "/usr/local/httpd/htdocs/xyz.com"
  3.         ServerName [url]www.xyz.com[/url]


  4. <IfModule dir_module>
  5.     DirectoryIndex index.php index.html
  6. </IfModule>

  7. <Directory />
  8. Allowoverride All
  9. </Directory>

  10.         <IfModule mpm_peruser_module>
  11.                 ServerEnvironment xyz xyz
  12.         </IfModule>
  13. </VirtualHost>
复制代码

请朋友们帮我看看是那里写错了。谢了

论坛徽章:
0
2 [报告]
发表于 2009-12-19 18:58 |只看该作者
有人看出是那里的问题了吗?我搞了两天了还没有看出问题的所在。

论坛徽章:
0
3 [报告]
发表于 2009-12-19 20:09 |只看该作者
已解决。在些感谢乔老大的全力帮助。配置文件其实没有问题的。是htacesss文件的问题。感谢乔老大的耐心的指教。

论坛徽章:
0
4 [报告]
发表于 2010-01-03 14:14 |只看该作者
呵呵      路过   解决就好啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP