Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[已答复] httpd.conf怎么编译Rewrite

[复制链接]
hssuhui 发表于 2009-10-28 09:18:49 | 显示全部楼层 |阅读模式
我找了没有
  1. LoadModule Rewrite_module modules/mod_Rewrite.so
复制代码
怎么编译啊
  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:http://httpd.apache.org/docs/2.2> for detailed information.
  5. # In particular, see
  6. # <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
  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/apache" will be interpreted by the
  18. # server as "/usr/local/apache/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/apache"

  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. admin@your-domain.com
  81. #
  82. ServerAdmin you@example.com

  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 www.example.com:80

  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/apache/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 None
  108.     Order deny,allow
  109.     Deny 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/apache/htdocs">
  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.     # http://httpd.apache.org/docs/2.2/mod/core.html#options
  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 None

  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 http://www.example.com/bar

  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/apache/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/apache/cgi-bin" should be changed to whatever your ScriptAliased
  237. # CGI directory exists, if you have that configured.
  238. #
  239. <Directory "/usr/local/apache/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.     # file specified in TypesConfig for specific file types.
  264.     #
  265.     #AddType application/x-gzip .tgz
  266.     #
  267.     # AddEncoding allows you to have certain browsers uncompress
  268.     # information on the fly. Note: Not all browsers support this.
  269.     #
  270.     #AddEncoding x-compress .Z
  271.     #AddEncoding x-gzip .gz .tgz
  272.     #
  273.     # If the AddEncoding directives above are commented-out, then you
  274.     # probably should define those extensions to indicate media types:
  275.     #
  276.     AddType application/x-compress .Z
  277.     AddType application/x-gzip .gz .tgz

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  350. # Secure (SSL/TLS) connections
  351. #Include conf/extra/httpd-ssl.conf
  352. #
  353. # Note: The following must must be present to support
  354. #       starting without SSL on platforms with no /dev/random equivalent
  355. #       but a statically compiled-in mod_ssl.
  356. #
  357. <IfModule ssl_module>
  358. SSLRandomSeed startup builtin
  359. SSLRandomSeed connect builtin
  360. </IfModule>
  361. <IfModule mime_module>      
  362.         AddType application/x-httpd-php .php    让网站支持PHP
  363. </IfModule>

  364. NameVirtualHost *:80
  365. Include conf/vhost.conf
  366. #<VirtualHost *>
  367. # ServerAdmin [email]webmaster@dummy-host.example.com[/email]
  368. # DocumentRoot /home/ftp/717_717/wwwroot
  369. # ServerName http://www.717.com.cn
  370. # ErrorLog logs/dummy-host.example.com-error_log
  371. # CustomLog logs/dummy-host.example.com-access_log commom
  372. # </virtualHost>
  373. RewriteEngine On
  374. RewriteRule ^/(space|network)\-(.+)\.html$ /$1.php?rewrite=$2 [L]
  375. RewriteRule ^/(space|network)\.html$ /$1.php [L]
  376. RewriteRule ^/([0-9]+)$ /space.php?uid=$1 [L]
复制代码
回复

使用道具 举报

五元超市 发表于 2009-10-28 09:41:23 | 显示全部楼层
加我QQ给你重写。
回复

使用道具 举报

 楼主| hssuhui 发表于 2009-10-28 12:00:38 | 显示全部楼层
不加了 给了你钱你就找不到你了
回复

使用道具 举报

云天一 发表于 2009-10-28 12:19:19 | 显示全部楼层
  1. <Directory "/usr/local/apache/htdocs">
复制代码
在这个后面加入rewrite规则
回复

使用道具 举报

 楼主| hssuhui 发表于 2009-10-28 14:35:46 | 显示全部楼层
不行 我这个服务有好几个域名了 bbs和uch 在不同的域名下
回复

使用道具 举报

云天一 发表于 2009-10-28 14:48:55 | 显示全部楼层
我才注意到你说
我找了没有


请按这里操作
http://faq.comsenz.com/viewnews-55
回复

使用道具 举报

jacklp 发表于 2009-11-9 23:23:32 | 显示全部楼层
没研究懂啊,高手出山吧
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-15 08:12 , Processed in 0.104371 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表