LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 712|回复: 14

不能正常建立Apache2和mysql服务

[复制链接]
发表于 2006-10-25 16:51:43 | 显示全部楼层 |阅读模式
通过apt-get安装了apache2和mysql-server。
但是不能建立起相关服务。
例如:apache2启动后,却不能访问,查看了一下80端口是有监听的,可就不能访问localhost(ServerName)。而没有任何错误的提示。在/var/log/apache2/erroe.log里显示的也只有“Apache/2.0.55 (Ubuntu) configured -- resuming normal operations ”就没有了。
谁遇见过,或者知道怎么解决?
发表于 2006-10-25 17:02:13 | 显示全部楼层
apache 的test页面也没出现过?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-25 18:04:50 | 显示全部楼层
没有出现过。
打开127.0.0.1,等了N久以后就是无法连接了。
回复 支持 反对

使用道具 举报

发表于 2006-10-25 18:16:32 | 显示全部楼层
那你可能apache没有启动,换root用户启动apache.
可以装个webmin,这样配置比较直观
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-25 18:43:16 | 显示全部楼层
不行的。
试过了的。
查看网络可以看见 协议是TCP6,但是IP源显示的是两个冒号,监听端口为80是正确的。
回复 支持 反对

使用道具 举报

发表于 2006-10-25 19:11:29 | 显示全部楼层
查一下/etc/apach2/conf/下的配置文件看一下,是不是有什么没把注释消掉
或者贴出来看看。

localhost也打不开啊?你的本地地址确定是127.0.0.1吗?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-25 19:19:54 | 显示全部楼层
文件为/etc/apache2/apache2.conf

  1. # Based upon the NCSA server configuration files originally by Rob McCool.
  2. # Changed extensively for the Debian package by Daniel Stone <daniel@sfarc.net>
  3. # and also by Thom May <thom@debian.org>.

  4. # ServerRoot: The top of the directory tree under which the server's
  5. # configuration, error, and log files are kept.
  6. #
  7. # NOTE!  If you intend to place this on an NFS (or otherwise network)
  8. # mounted filesystem then please read the LockFile documentation
  9. # (available at <URL:http://www.apache.org/docs/mod/core.html#lockfile>);
  10. # you will save yourself a lot of trouble.

  11. ServerRoot "/etc/apache2"
  12. ServerName localhost:80

  13. # The LockFile directive sets the path to the lockfile used when Apache
  14. # is compiled with either USE_FCNTL_SERIALIZED_ACCEPT or
  15. # USE_FLOCK_SERIALIZED_ACCEPT. This directive should normally be left at
  16. # its default value. The main reason for changing it is if the logs
  17. # directory is NFS mounted, since the lockfile MUST BE STORED ON A LOCAL
  18. # DISK. The PID of the main server process is automatically appended to
  19. # the filename.

  20. LockFile /var/lock/apache2/accept.lock

  21. # PidFile: The file in which the server should record its process
  22. # identification number when it starts.

  23. PidFile /var/run/apache2.pid

  24. # Timeout: The number of seconds before receives and sends time out.

  25. Timeout 300

  26. # KeepAlive: Whether or not to allow persistent connections (more than
  27. # one request per connection). Set to "Off" to deactivate.

  28. KeepAlive On

  29. # MaxKeepAliveRequests: The maximum number of requests to allow
  30. # during a persistent connection. Set to 0 to allow an unlimited amount.
  31. # We recommend you leave this number high, for maximum performance.

  32. MaxKeepAliveRequests 100

  33. # KeepAliveTimeout: Number of seconds to wait for the next request from the
  34. # same client on the same connection.

  35. KeepAliveTimeout 15

  36. ##
  37. ## Server-Pool Size Regulation (MPM specific)
  38. ##

  39. # prefork MPM
  40. # StartServers ......... number of server processes to start
  41. # MinSpareServers ...... minimum number of server processes which are kept spare
  42. # MaxSpareServers ...... maximum number of server processes which are kept spare
  43. # MaxClients ........... maximum number of server processes allowed to start
  44. # MaxRequestsPerChild .. maximum number of requests a server process serves
  45. <IfModule prefork.c>
  46. StartServers         5
  47. MinSpareServers      5
  48. MaxSpareServers     10
  49. MaxClients          20
  50. MaxRequestsPerChild  0
  51. </IfModule>

  52. # pthread MPM
  53. # StartServers ......... initial  number of server processes to start
  54. # MaxClients ........... maximum  number of server processes allowed to start
  55. # MinSpareThreads ...... minimum  number of worker threads which are kept spare
  56. # MaxSpareThreads ...... maximum  number of worker threads which are kept spare
  57. # ThreadsPerChild ...... constant number of worker threads in each server process
  58. # MaxRequestsPerChild .. maximum  number of requests a server process serves
  59. <IfModule worker.c>
  60. StartServers         2
  61. MaxClients         150
  62. MinSpareThreads     25
  63. MaxSpareThreads     75
  64. ThreadsPerChild     25
  65. MaxRequestsPerChild  0
  66. </IfModule>

  67. # perchild MPM
  68. # NumServers ........... constant number of server processes
  69. # StartThreads ......... initial  number of worker threads in each server process
  70. # MinSpareThreads ...... minimum  number of worker threads which are kept spare
  71. # MaxSpareThreads ...... maximum  number of worker threads which are kept spare
  72. # MaxThreadsPerChild ... maximum  number of worker threads in each server process
  73. # MaxRequestsPerChild .. maximum  number of connections per server process (then it dies)
  74. <IfModule perchild.c>
  75. NumServers           5
  76. StartThreads         5
  77. MinSpareThreads      5
  78. MaxSpareThreads     10
  79. MaxThreadsPerChild  20
  80. MaxRequestsPerChild  0
  81. AcceptMutex fcntl
  82. </IfModule>

  83. User www-data
  84. Group www-data

  85. # The following directives define some format nicknames for use with
  86. # a CustomLog directive (see below).
  87. LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
  88. LogFormat "%h %l %u %t "%r" %>s %b" common
  89. LogFormat "%{Referer}i -> %U" referer
  90. LogFormat "%{User-agent}i" agent


  91. # Global error log.
  92. ErrorLog /var/log/apache2/error.log

  93. # Include module configuration:
  94. Include /etc/apache2/mods-enabled/*.load
  95. Include /etc/apache2/mods-enabled/*.conf

  96. # Include all the user configurations:
  97. Include /etc/apache2/httpd.conf

  98. # Include ports listing
  99. Include /etc/apache2/ports.conf

  100. # Include generic snippets of statements
  101. Include /etc/apache2/conf.d/[^.#]*

  102. #Let's have some Icons, shall we?
  103. Alias /icons/ "/usr/share/apache2/icons/"
  104. <Directory "/usr/share/apache2/icons">
  105.     Options Indexes MultiViews
  106.     AllowOverride None
  107.     Order allow,deny
  108.     Allow from all
  109. </Directory>

  110. # Set up the default error docs.
  111. #
  112. # Customizable error responses come in three flavors:
  113. # 1) plain text 2) local redirects 3) external redirects
  114. #
  115. # Some examples:
  116. #ErrorDocument 500 "The server made a boo boo."
  117. #ErrorDocument 404 /missing.html
  118. #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
  119. #ErrorDocument 402 http://www.example.com/subscription_info.html
  120. #

  121. #
  122. # Putting this all together, we can Internationalize error responses.
  123. #
  124. # We use Alias to redirect any /error/HTTP_<error>.html.var response to
  125. # our collection of by-error message multi-language collections.  We use
  126. # includes to substitute the appropriate text.
  127. #
  128. # You can modify the messages' appearance without changing any of the
  129. # default HTTP_<error>.html.var files by adding the line;
  130. #
  131. #   Alias /error/include/ "/your/include/path/"
  132. #
  133. # which allows you to create your own set of files by starting with the
  134. # /usr/local/apache2/error/include/ files and
  135. # copying them to /your/include/path/, even on a per-VirtualHost basis.
  136. #

  137. <IfModule mod_negotiation.c>
  138. <IfModule mod_include.c>
  139.     Alias /error/ "/usr/share/apache2/error/"

  140.     <Directory "/usr/share/apache2/error">
  141.         AllowOverride None
  142.         Options IncludesNoExec
  143.         AddOutputFilter Includes html
  144.         AddHandler type-map var
  145.         Order allow,deny
  146.         Allow from all
  147.         LanguagePriority en es de fr
  148.         ForceLanguagePriority Prefer Fallback
  149.     </Directory>

  150.     ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
  151.     ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
  152.     ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
  153.     ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
  154.     ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
  155.     ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
  156.     ErrorDocument 410 /error/HTTP_GONE.html.var
  157.     ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
  158.     ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
  159.     ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
  160.     ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
  161.     ErrorDocument 415 /error/HTTP_SERVICE_UNAVAILABLE.html.var
  162.     ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
  163.     ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
  164.     ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
  165.     ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
  166.     ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

  167. </IfModule>
  168. </IfModule>

  169. DirectoryIndex index.html index.cgi index.pl index.php index.xhtml

  170. # UserDir is now a module
  171. #UserDir public_html
  172. #UserDir disabled root

  173. #<Directory /home/*/public_html>
  174. #        AllowOverride FileInfo AuthConfig Limit
  175. #        Options Indexes SymLinksIfOwnerMatch IncludesNoExec
  176. #</Directory>

  177. AccessFileName .htaccess

  178. <Files ~ "^\.ht">
  179.     Order allow,deny
  180.     Deny from all
  181. </Files>

  182. UseCanonicalName Off

  183. TypesConfig /etc/mime.types
  184. DefaultType text/plain

  185. HostnameLookups Off

  186. IndexOptions FancyIndexing VersionSort

  187. AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

  188. AddIconByType (TXT,/icons/text.gif) text/*
  189. AddIconByType (IMG,/icons/image2.gif) image/*
  190. AddIconByType (SND,/icons/sound2.gif) audio/*
  191. AddIconByType (VID,/icons/movie.gif) video/*

  192. # This really should be .jpg.

  193. AddIcon /icons/binary.gif .bin .exe
  194. AddIcon /icons/binhex.gif .hqx
  195. AddIcon /icons/tar.gif .tar
  196. AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
  197. AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
  198. AddIcon /icons/a.gif .ps .ai .eps
  199. AddIcon /icons/layout.gif .html .shtml .htm .pdf
  200. AddIcon /icons/text.gif .txt
  201. AddIcon /icons/c.gif .c
  202. AddIcon /icons/p.gif .pl .py
  203. AddIcon /icons/f.gif .for
  204. AddIcon /icons/dvi.gif .dvi
  205. AddIcon /icons/uuencoded.gif .uu
  206. AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
  207. AddIcon /icons/tex.gif .tex
  208. AddIcon /icons/bomb.gif core

  209. AddIcon /icons/back.gif ..
  210. AddIcon /icons/hand.right.gif README
  211. AddIcon /icons/folder.gif ^^DIRECTORY^^
  212. AddIcon /icons/blank.gif ^^BLANKICON^^


  213. # This is from Matty J's patch. Anyone want to make the icons?
  214. #AddIcon /icons/dirsymlink.jpg ^^SYMDIR^^
  215. #AddIcon /icons/symlink.jpg ^^SYMLINK^^

  216. DefaultIcon /icons/unknown.gif

  217. ReadmeName README.html
  218. HeaderName HEADER.html

  219. IndexIgnore .??* *~ *# HEADER* RCS CVS *,t

  220. AddEncoding x-compress Z
  221. AddEncoding x-gzip gz tgz

  222. AddLanguage da .dk
  223. AddLanguage nl .nl
  224. AddLanguage en .en
  225. AddLanguage et .et
  226. AddLanguage fr .fr
  227. AddLanguage de .de
  228. AddLanguage el .el
  229. AddLanguage it .it
  230. AddLanguage ja .ja
  231. AddLanguage pl .po
  232. AddLanguage ko .ko
  233. AddLanguage pt .pt
  234. AddLanguage no .no
  235. AddLanguage pt-br .pt-br
  236. AddLanguage ltz .ltz
  237. AddLanguage ca .ca
  238. AddLanguage es .es
  239. AddLanguage sv .se
  240. AddLanguage cz .cz
  241. AddLanguage ru .ru
  242. AddLanguage tw .tw
  243. AddLanguage zh-tw .tw

  244. LanguagePriority en da nl et fr de el it ja ko no pl pt pt-br ltz ca es sv tw


  245. #AddDefaultCharset        ISO-8859-1

  246. AddCharset ISO-8859-1  .iso8859-1  .latin1
  247. AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
  248. AddCharset ISO-8859-3  .iso8859-3  .latin3
  249. AddCharset ISO-8859-4  .iso8859-4  .latin4
  250. AddCharset ISO-8859-5  .iso8859-5  .latin5 .cyr .iso-ru
  251. AddCharset ISO-8859-6  .iso8859-6  .latin6 .arb
  252. AddCharset ISO-8859-7  .iso8859-7  .latin7 .grk
  253. AddCharset ISO-8859-8  .iso8859-8  .latin8 .heb       
  254. AddCharset ISO-8859-9  .iso8859-9  .latin9 .trk
  255. AddCharset ISO-2022-JP .iso2022-jp .jis
  256. AddCharset ISO-2022-KR .iso2022-kr .kis
  257. AddCharset ISO-2022-CN .iso2022-cn .cis
  258. AddCharset Big5        .Big5       .big5
  259. # For russian, more than one charset is used (depends on client, mostly):
  260. AddCharset WINDOWS-1251 .cp-1251   .win-1251
  261. AddCharset CP866       .cp866
  262. AddCharset KOI8-r      .koi8-r .koi8-ru
  263. AddCharset KOI8-ru     .koi8-uk .ua
  264. AddCharset ISO-10646-UCS-2 .ucs2
  265. AddCharset ISO-10646-UCS-4 .ucs4
  266. AddCharset UTF-8       .utf8

  267. AddCharset GB2312      .gb2312 .gb
  268. AddCharset utf-7       .utf7
  269. AddCharset utf-8       .utf8
  270. AddCharset big5               .big5 .b5
  271. AddCharset EUC-TW      .euc-tw       
  272. AddCharset EUC-JP      .euc-jp
  273. AddCharset EUC-KR      .euc-kr
  274. AddCharset shift_jis   .sjis

  275. #AddType application/x-httpd-php .php
  276. #AddType application/x-httpd-php-source .phps

  277. AddType application/x-tar .tgz

  278. # To use CGI scripts outside /cgi-bin/:
  279. #
  280. #AddHandler cgi-script .cgi

  281. # To use server-parsed HTML files
  282. #
  283. <FilesMatch "\.shtml(\..+)?$">
  284.     SetOutputFilter INCLUDES
  285. </FilesMatch>

  286. # If you wish to use server-parsed imagemap files, use
  287. #
  288. #AddHandler imap-file map

  289. BrowserMatch "Mozilla/2" nokeepalive
  290. BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
  291. BrowserMatch "RealPlayer 4\.0" force-response-1.0
  292. BrowserMatch "Java/1\.0" force-response-1.0
  293. BrowserMatch "JDK/1\.0" force-response-1.0

  294. #
  295. # The following directive disables redirects on non-GET requests for
  296. # a directory that does not include the trailing slash.  This fixes a
  297. # problem with Microsoft WebFolders which does not appropriately handle
  298. # redirects for folders with DAV methods.
  299. #

  300. BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
  301. BrowserMatch "^WebDrive" redirect-carefully
  302. BrowserMatch "^gnome-vfs" redirect-carefully
  303. BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully

  304. # Allow server status reports, with the URL of http://servername/server-status
  305. # Change the ".your_domain.com" to match your domain to enable.
  306. #
  307. #<Location /server-status>
  308. #    SetHandler server-status
  309. #    Order deny,allow
  310. #    Deny from all
  311. #    Allow from .your_domain.com
  312. #</Location>

  313. # Allow remote server configuration reports, with the URL of
  314. #  http://servername/server-info (requires that mod_info.c be loaded).
  315. # Change the ".your_domain.com" to match your domain to enable.
  316. #
  317. #<Location /server-info>
  318. #    SetHandler server-info
  319. #    Order deny,allow
  320. #    Deny from all
  321. #    Allow from .your_domain.com
  322. #</Location>

  323. # Include the virtual host configurations:
  324. Include /etc/apache2/sites-enabled/[^.#]*

复制代码
回复 支持 反对

使用道具 举报

发表于 2006-10-25 19:31:19 | 显示全部楼层
DocumentRoot  
没有设置啊
DocumentRoot "服务器目录(当然要包括index)"

DocumentRoot "/usr/Apache2/htdocs"(一般好像是这里)
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-25 19:50:44 | 显示全部楼层
设置了,还是不行。
回复 支持 反对

使用道具 举报

发表于 2006-10-25 20:10:44 | 显示全部楼层
你的/usr/apache2/htdocs下有index.html吗?
地址不能照搬的。我上面只是个例子
回复 支持 反对

使用道具 举报

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

本版积分规则

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