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

 找回密码
 立即注册
搜索

apache 虚拟主机 设置 问题

[复制链接]
nickjie 发表于 2007-5-17 14:03:02 | 显示全部楼层 |阅读模式
  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 "D:/local/apache2" will be interpreted by the
  18. # server as "D:/local/apache2/logs/foo.log".
  19. #
  20. # NOTE: Where filenames are specified, you must use forward slashes
  21. # instead of backslashes (e.g., "c:/apache" instead of "c:\apache").
  22. # If a drive letter is omitted, the drive on which Apache.exe is located
  23. # will be used by default.  It is recommended that you always supply
  24. # an explicit drive letter in absolute paths, however, to avoid
  25. # confusion.
  26. #

  27. # ThreadsPerChild: constant number of worker threads in the server process
  28. # MaxRequestsPerChild: maximum  number of requests a server process serves
  29. ThreadsPerChild 250
  30. MaxRequestsPerChild  0

  31. #
  32. # ServerRoot: The top of the directory tree under which the server's
  33. # configuration, error, and log files are kept.
  34. #
  35. # Do not add a slash at the end of the directory path.  If you point
  36. # ServerRoot at a non-local disk, be sure to point the LockFile directive
  37. # at a local disk.  If you wish to share the same ServerRoot for multiple
  38. # httpd daemons, you will need to change at least LockFile and PidFile.
  39. #
  40. ServerRoot "D:/local/apache2"

  41. #
  42. # Listen: Allows you to bind Apache to specific IP addresses and/or
  43. # ports, instead of the default. See also the <VirtualHost>
  44. # directive.
  45. #
  46. # Change this to Listen on specific IP addresses as shown below to
  47. # prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
  48. #
  49. #Listen 12.34.56.78:80
  50. Listen 80

  51. #
  52. # Dynamic Shared Object (DSO) Support
  53. #
  54. # To be able to use the functionality of a module which was built as a DSO you
  55. # have to place corresponding `LoadModule' lines at this location so the
  56. # directives contained in it are actually available _before_ they are used.
  57. # Statically compiled modules (those listed by `httpd -l') do not need
  58. # to be loaded here.
  59. #
  60. # Example:
  61. # LoadModule foo_module modules/mod_foo.so
  62. #
  63. LoadModule actions_module modules/mod_actions.so
  64. LoadModule alias_module modules/mod_alias.so
  65. LoadModule asis_module modules/mod_asis.so
  66. LoadModule auth_basic_module modules/mod_auth_basic.so
  67. #LoadModule auth_digest_module modules/mod_auth_digest.so
  68. #LoadModule authn_anon_module modules/mod_authn_anon.so
  69. #LoadModule authn_dbm_module modules/mod_authn_dbm.so
  70. LoadModule authn_default_module modules/mod_authn_default.so
  71. LoadModule authn_file_module modules/mod_authn_file.so
  72. #LoadModule authz_dbm_module modules/mod_authz_dbm.so
  73. LoadModule authz_default_module modules/mod_authz_default.so
  74. LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
  75. LoadModule authz_host_module modules/mod_authz_host.so
  76. LoadModule authz_user_module modules/mod_authz_user.so
  77. LoadModule autoindex_module modules/mod_autoindex.so
  78. #LoadModule cern_meta_module modules/mod_cern_meta.so
  79. LoadModule cgi_module modules/mod_cgi.so
  80. #LoadModule dav_module modules/mod_dav.so
  81. #LoadModule dav_fs_module modules/mod_dav_fs.so
  82. #LoadModule deflate_module modules/mod_deflate.so
  83. LoadModule dir_module modules/mod_dir.so
  84. LoadModule env_module modules/mod_env.so
  85. #LoadModule expires_module modules/mod_expires.so
  86. #LoadModule file_cache_module modules/mod_file_cache.so
  87. #LoadModule headers_module modules/mod_headers.so
  88. LoadModule imagemap_module modules/mod_imagemap.so
  89. LoadModule include_module modules/mod_include.so
  90. #LoadModule info_module modules/mod_info.so
  91. LoadModule isapi_module modules/mod_isapi.so
  92. LoadModule log_config_module modules/mod_log_config.so
  93. LoadModule mime_module modules/mod_mime.so
  94. #LoadModule mime_magic_module modules/mod_mime_magic.so
  95. #LoadModule proxy_module modules/mod_proxy.so
  96. #LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
  97. #LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  98. #LoadModule proxy_connect_module modules/mod_proxy_connect.so
  99. #LoadModule proxy_http_module modules/mod_proxy_http.so
  100. #LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
  101. LoadModule negotiation_module modules/mod_negotiation.so
  102. LoadModule rewrite_module modules/mod_rewrite.so
  103. <IfModule mod_rewrite.c>
  104.                 RewriteEngine On
  105.                 RewriteRule ^(.*)/archiver/([a-z0-9\-]+\.html)$ $1/archiver/index.php?$2
  106.                 RewriteRule ^(.*)/forum-([0-9]+)-([0-9]+)\.html$ $1/forumdisplay.php?fid=$2&page=$3
  107.                 RewriteRule ^(.*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/viewthread.php?tid=$2&extra=page\%3D$4&page=$3
  108.                 RewriteRule ^(.*)/profile-(username|uid)-(.+)\.html$ $1/viewpro.php?$2=$3
  109.                 RewriteRule ^(.*)/space-(username|uid)-(.+)\.html$ $1/space.php?$2=$3
  110.         </IfModule>

  111. LoadModule setenvif_module modules/mod_setenvif.so
  112. #LoadModule speling_module modules/mod_speling.so
  113. #LoadModule status_module modules/mod_status.so
  114. #LoadModule unique_id_module modules/mod_unique_id.so
  115. LoadModule userdir_module modules/mod_userdir.so
  116. #LoadModule usertrack_module modules/mod_usertrack.so
  117. #LoadModule vhost_alias_module modules/mod_vhost_alias.so
  118. #LoadModule ssl_module modules/mod_ssl.so
  119. LoadModule php5_module "d:/local/php5/php5apache2_2.dll"

  120. # 'Main' server configuration
  121. #
  122. # The directives in this section set up the values used by the 'main'
  123. # server, which responds to any requests that aren't handled by a
  124. # <VirtualHost> definition.  These values also provide defaults for
  125. # any <VirtualHost> containers you may define later in the file.
  126. #
  127. # All of these directives may appear inside <VirtualHost> containers,
  128. # in which case these default settings will be overridden for the
  129. # virtual host being defined.
  130. #

  131. #
  132. # ServerAdmin: Your address, where problems with the server should be
  133. # e-mailed.  This address appears on some server-generated pages, such
  134. # as error documents.  e.g. [email]admin@your-domain.com[/email]
  135. #
  136. ServerAdmin [email]jie_nick@hotmail.com[/email]

  137. #
  138. # ServerName gives the name and port that the server uses to identify itself.
  139. # This can often be determined automatically, but we recommend you specify
  140. # it explicitly to prevent problems during startup.
  141. #
  142. # If your host doesn't have a registered DNS name, enter its IP address here.
  143. #
  144. ServerName localhost:80

  145. #
  146. # DocumentRoot: The directory out of which you will serve your
  147. # documents. By default, all requests are taken from this directory, but
  148. # symbolic links and aliases may be used to point to other locations.
  149. #
  150. DocumentRoot "D:\local\wwwroot"

  151. #
  152. # Each directory to which Apache has access can be configured with respect
  153. # to which services and features are allowed and/or disabled in that
  154. # directory (and its subdirectories).
  155. #
  156. # First, we configure the "default" to be a very restrictive set of
  157. # features.  
  158. #
  159. <Directory />
  160.     Options FollowSymLinks
  161.     AllowOverride None
  162.     Order deny,allow
  163.     Deny from all
  164.     Satisfy all
  165. </Directory>

  166. #
  167. # Note that from this point forward you must specifically allow
  168. # particular features to be enabled - so if something's not working as
  169. # you might expect, make sure that you have specifically enabled it
  170. # below.
  171. #

  172. #
  173. # This should be changed to whatever you set DocumentRoot to.
  174. #
  175. <Directory "D:\local\wwwroot">
  176.     #
  177.     # Possible values for the Options directive are "None", "All",
  178.     # or any combination of:
  179.     #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  180.     #
  181.     # Note that "MultiViews" must be named *explicitly* --- "Options All"
  182.     # doesn't give it to you.
  183.     #
  184.     # The Options directive is both complicated and important.  Please see
  185.     # [url]http://httpd.apache.org/docs/2.2/mod/core.html#options[/url]
  186.     # for more information.
  187.     #
  188.     Options Indexes FollowSymLinks

  189.     #
  190.     # AllowOverride controls what directives may be placed in .htaccess files.
  191.     # It can be "All", "None", or any combination of the keywords:
  192.     #   Options FileInfo AuthConfig Limit
  193.     #
  194.     AllowOverride None

  195.     #
  196.     # Controls who can get stuff from this server.
  197.     #
  198.     Order allow,deny
  199.     Allow from all

  200. </Directory>

  201. #
  202. # DirectoryIndex: sets the file that Apache will serve if a directory
  203. # is requested.
  204. #
  205. <IfModule dir_module>
  206.     DirectoryIndex index.html index.htm index.php default.php
  207. </IfModule>

  208. #
  209. # The following lines prevent .htaccess and .htpasswd files from being
  210. # viewed by Web clients.
  211. #
  212. <FilesMatch "^\.ht">
  213.     Order allow,deny
  214.     Deny from all
  215. </FilesMatch>

  216. #
  217. # ErrorLog: The location of the error log file.
  218. # If you do not specify an ErrorLog directive within a <VirtualHost>
  219. # container, error messages relating to that virtual host will be
  220. # logged here.  If you *do* define an error logfile for a <VirtualHost>
  221. # container, that host's errors will be logged there and not here.
  222. #
  223. ErrorLog logs/error.log

  224. #
  225. # LogLevel: Control the number of messages logged to the error_log.
  226. # Possible values include: debug, info, notice, warn, error, crit,
  227. # alert, emerg.
  228. #
  229. LogLevel warn

  230. <IfModule log_config_module>
  231.     #
  232.     # The following directives define some format nicknames for use with
  233.     # a CustomLog directive (see below).
  234.     #
  235.     LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
  236.     LogFormat "%h %l %u %t "%r" %>s %b" common

  237.     <IfModule logio_module>
  238.       # You need to enable mod_logio.c to use %I and %O
  239.       LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i" %I %O" combinedio
  240.     </IfModule>

  241.     #
  242.     # The location and format of the access logfile (Common Logfile Format).
  243.     # If you do not define any access logfiles within a <VirtualHost>
  244.     # container, they will be logged here.  Contrariwise, if you *do*
  245.     # define per-<VirtualHost> access logfiles, transactions will be
  246.     # logged therein and *not* in this file.
  247.     #
  248.     CustomLog logs/access.log common

  249.     #
  250.     # If you prefer a logfile with access, agent, and referer information
  251.     # (Combined Logfile Format) you can use the following directive.
  252.     #
  253.     #CustomLog logs/access.log combined
  254. </IfModule>

  255. <IfModule alias_module>
  256.     #
  257.     # Redirect: Allows you to tell clients about documents that used to
  258.     # exist in your server's namespace, but do not anymore. The client
  259.     # will make a new request for the document at its new location.
  260.     # Example:
  261.     # Redirect permanent /foo http://localhost/bar

  262.     #
  263.     # Alias: Maps web paths into filesystem paths and is used to
  264.     # access content that does not live under the DocumentRoot.
  265.     # Example:
  266.     # Alias /webpath /full/filesystem/path
  267.     #
  268.     # If you include a trailing / on /webpath then the server will
  269.     # require it to be present in the URL.  You will also likely
  270.     # need to provide a <Directory> section to allow access to
  271.     # the filesystem path.

  272.     #
  273.     # ScriptAlias: This controls which directories contain server scripts.
  274.     # ScriptAliases are essentially the same as Aliases, except that
  275.     # documents in the target directory are treated as applications and
  276.     # run by the server when requested rather than as documents sent to the
  277.     # client.  The same rules about trailing "/" apply to ScriptAlias
  278.     # directives as to Alias.
  279.     #
  280.     ScriptAlias /cgi-bin/ "D:/local/apache2/cgi-bin/"

  281. </IfModule>

  282. #
  283. # "D:/local/apache2/cgi-bin" should be changed to whatever your ScriptAliased
  284. # CGI directory exists, if you have that configured.
  285. #
  286. <Directory "D:/local/apache2/cgi-bin">
  287.     AllowOverride None
  288.     Options None
  289.     Order allow,deny
  290.     Allow from all
  291. </Directory>

  292. #
  293. # Apache parses all CGI scripts for the shebang line by default.
  294. # This comment line, the first line of the script, consists of the symbols
  295. # pound (#) and exclamation (!) followed by the path of the program that
  296. # can execute this specific script.  For a perl script, with perl.exe in
  297. # the C:\Program Files\Perl directory, the shebang line should be:

  298.    #!c:/program files/perl/perl

  299. # Note you _must_not_ indent the actual shebang line, and it must be the
  300. # first line of the file.  Of course, CGI processing must be enabled by
  301. # the appropriate ScriptAlias or Options ExecCGI directives for the files
  302. # or directory in question.
  303. #
  304. # However, Apache on Windows allows either the Unix behavior above, or can
  305. # use the Registry to match files by extention.  The command to execute
  306. # a file of this type is retrieved from the registry by the same method as
  307. # the Windows Explorer would use to handle double-clicking on a file.
  308. # These script actions can be configured from the Windows Explorer View menu,
  309. # 'Folder Options', and reviewing the 'File Types' tab.  Clicking the Edit
  310. # button allows you to modify the Actions, of which Apache 1.3 attempts to
  311. # perform the 'Open' Action, and failing that it will try the shebang line.
  312. # This behavior is subject to change in Apache release 2.0.
  313. #
  314. # Each mechanism has it's own specific security weaknesses, from the means
  315. # to run a program you didn't intend the website owner to invoke, and the
  316. # best method is a matter of great debate.
  317. #
  318. # To enable the this Windows specific behavior (and therefore -disable- the
  319. # equivilant Unix behavior), uncomment the following directive:
  320. #
  321. #ScriptInterpreterSource registry
  322. #
  323. # The directive above can be placed in individual <Directory> blocks or the
  324. # .htaccess file, with either the 'registry' (Windows behavior) or 'script'
  325. # (Unix behavior) option, and will override this server default option.
  326. #

  327. #
  328. # DefaultType: the default MIME type the server will use for a document
  329. # if it cannot otherwise determine one, such as from filename extensions.
  330. # If your server contains mostly text or HTML documents, "text/plain" is
  331. # a good value.  If most of your content is binary, such as applications
  332. # or images, you may want to use "application/octet-stream" instead to
  333. # keep browsers from trying to display binary files as though they are
  334. # text.
  335. #
  336. DefaultType text/plain

  337. <IfModule mime_module>
  338.     #
  339.     # TypesConfig points to the file containing the list of mappings from
  340.     # filename extension to MIME-type.
  341.     #
  342.     TypesConfig conf/mime.types

  343.     #
  344.     # AddType allows you to add to or override the MIME configuration
  345.     # file specified in TypesConfig for specific file types.
  346.     #
  347.     #AddType application/x-gzip .tgz
  348.     #
  349.     # AddEncoding allows you to have certain browsers uncompress
  350.     # information on the fly. Note: Not all browsers support this.
  351.     #
  352.     #AddEncoding x-compress .Z
  353.     #AddEncoding x-gzip .gz .tgz
  354.     #
  355.     # If the AddEncoding directives above are commented-out, then you
  356.     # probably should define those extensions to indicate media types:
  357.     #
  358.     AddType application/x-compress .Z
  359.     AddType application/x-gzip .gz .tgz
  360.     AddType application/x-httpd-php .php

  361.     #
  362.     # AddHandler allows you to map certain file extensions to "handlers":
  363.     # actions unrelated to filetype. These can be either built into the server
  364.     # or added with the Action directive (see below)
  365.     #
  366.     # To use CGI scripts outside of ScriptAliased directories:
  367.     # (You will also need to add "ExecCGI" to the "Options" directive.)
  368.     #
  369.     #AddHandler cgi-script .cgi

  370.     # For type maps (negotiated resources):
  371.     #AddHandler type-map var

  372.     #
  373.     # Filters allow you to process content before it is sent to the client.
  374.     #
  375.     # To parse .shtml files for server-side includes (SSI):
  376.     # (You will also need to add "Includes" to the "Options" directive.)
  377.     #
  378.     #AddType text/html .shtml
  379.     #AddOutputFilter INCLUDES .shtml
  380. </IfModule>

  381. #
  382. # The mod_mime_magic module allows the server to use various hints from the
  383. # contents of the file itself to determine its type.  The MIMEMagicFile
  384. # directive tells the module where the hint definitions are located.
  385. #
  386. #MIMEMagicFile conf/magic

  387. #
  388. # Customizable error responses come in three flavors:
  389. # 1) plain text 2) local redirects 3) external redirects
  390. #
  391. # Some examples:
  392. #ErrorDocument 500 "The server made a boo boo."
  393. #ErrorDocument 404 /missing.html
  394. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  395. #ErrorDocument 402 http://localhost/subscription_info.html
  396. #

  397. #
  398. # EnableMMAP and EnableSendfile: On systems that support it,
  399. # memory-mapping or the sendfile syscall is used to deliver
  400. # files.  This usually improves server performance, but must
  401. # be turned off when serving from networked-mounted
  402. # filesystems or if support for these functions is otherwise
  403. # broken on your system.
  404. #
  405. #EnableMMAP off
  406. #EnableSendfile off

  407. # Supplemental configuration
  408. #
  409. # The configuration files in the conf/extra/ directory can be
  410. # included to add extra features or to modify the default configuration of
  411. # the server, or you may simply copy their contents here and change as
  412. # necessary.

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

  415. # Multi-language error messages
  416. #Include conf/extra/httpd-multilang-errordoc.conf

  417. # Fancy directory listings
  418. #Include conf/extra/httpd-autoindex.conf

  419. # Language settings
  420. #Include conf/extra/httpd-languages.conf

  421. # User home directories
  422. #Include conf/extra/httpd-userdir.conf

  423. # Real-time info on requests and configuration
  424. #Include conf/extra/httpd-info.conf

  425. # Virtual hosts
  426. #Include conf/extra/httpd-vhosts.conf

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

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

  431. # Various default settings
  432. #Include conf/extra/httpd-default.conf

  433. # Secure (SSL/TLS) connections
  434. #Include conf/extra/httpd-ssl.conf
  435. #
  436. # Note: The following must must be present to support
  437. #       starting without SSL on platforms with no /dev/random equivalent
  438. #       but a statically compiled-in mod_ssl.
  439. #
  440. <IfModule ssl_module>
  441. SSLRandomSeed startup builtin
  442. SSLRandomSeed connect builtin
  443. </IfModule>

  444. NameVirtualHost *

  445. <VirtualHost *:80>
  446.     ServerAdmin [email]webmaster@txkk.cn[/email]   
  447.     ServerName [url]www.txkk.cn[/url]
  448.     ServerAlias [url]www.txkk.cn[/url]
  449.     DocumentRoot D:/local/wwwroot/
  450.     ErrorLog logs/127.0.0.1-error_log
  451.     CustomLog logs/127.0.0.1-access_log combined
  452.     DirectoryIndex index.htm index.html index.php index.php3 index.cgi index.pl
  453.     DefaultLanguage zh-CN
  454.     AddDefaultCharset GB2312

  455.    <IfDefine PHP>
  456.       php_admin_flag engine on
  457.       php_admin_flag safe_mode off
  458.       php_admin_value open_basedir none
  459.       php_admin_value session.save_path "/usr/local/tmp/php/session"
  460.       php_admin_value open_basedir "D:/local/wwwroot/;/usr/local/tmp/php"
  461.    </IfDefine>
  462. </VirtualHost>


  463. <VirtualHost *:80>

  464.     ServerAdmin [email]webmaster@tx365.cn[/email]
  465.     ServerName [url]www.tx365.cn[/url]
  466.     ServerAlias [url]www.tx365.cn[/url]
  467.     DocumentRoot D:/local/tx365/

  468.     DirectoryIndex index.htm index.html index.php index.php3 index.cgi index.pl

  469. </VirtualHost>
复制代码


现在www.txkk.cn可以访问

     www.tx365.cn禁止访问了

大家看看
1qq.gif
回复

使用道具 举报

 楼主| nickjie 发表于 2007-5-17 14:19:29 | 显示全部楼层
嗨。。。还是去装个2003系统 用个IIS 算了
回复

使用道具 举报

pc77maikongjian 发表于 2007-5-17 15:01:58 | 显示全部楼层
回复

使用道具 举报

 楼主| nickjie 发表于 2007-5-17 20:00:17 | 显示全部楼层
晕,,,发我的是什么啊 .... APACHE 和 IIS是一样的吗?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 15:19 , Processed in 0.096591 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

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