首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >DocumentRoot接受一个参数,即文档树错误的根目录

问DocumentRoot接受一个参数,即文档树错误的根目录
EN

Server Fault用户
提问于 2018-04-09 16:28:04
回答 1查看 2.9K关注 0票数 1

好的,我在我的电脑xubuntu上有这个linux操作系统,外部IP不能通过内部或外部网络工作,也不能在我的pc上工作。只是说404找不到。我能做什么?

这是000-default.conf,我还尝试了/var/www/html:

代码语言:javascript
复制
Servername 
ServerAdmin webmaster@localhost
DocumentRoot "/var/www"            # try quoting
DirectoryIndex index.html               # just in case
ErrorLog /var/log/apache2/error.log        # fully specified
CustomLog /var/log/apache2/acces.log      # fully specified
             # quoted
    AllowOverride All
    Require all granted                 # required in Apache 2.4

这是error.log:

代码语言:javascript
复制
    [Mon Apr 09 17:00:10.218418 2018] [mpm_event:notice] [pid 19936:tid 139990600419200] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 17:00:10.218550 2018] [core:notice] [pid 19936:tid 139990600419200] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 17:08:21.130698 2018] [mpm_event:notice] [pid 19936:tid 139990600419200] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 17:08:22.235195 2018] [mpm_event:notice] [pid 20519:tid 139868456769408] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 17:08:22.235323 2018] [core:notice] [pid 20519:tid 139868456769408] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 17:10:02.485055 2018] [mpm_event:notice] [pid 20519:tid 139868456769408] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 17:12:24.738049 2018] [mpm_event:notice] [pid 1729:tid 140330444584832] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 17:12:24.794357 2018] [core:notice] [pid 1729:tid 140330444584832] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 17:25:02.357488 2018] [mpm_event:notice] [pid 1729:tid 140330444584832] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 17:25:03.449348 2018] [mpm_event:notice] [pid 3730:tid 140047470462848] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 17:25:03.449459 2018] [core:notice] [pid 3730:tid 140047470462848] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 17:50:02.495314 2018] [mpm_event:notice] [pid 3730:tid 140047470462848] AH00493: SIGUSR1 received.  Doing graceful restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
    [Mon Apr 09 17:50:02.500105 2018] [mpm_event:notice] [pid 3730:tid 140047470462848] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 17:50:02.500112 2018] [core:notice] [pid 3730:tid 140047470462848] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 18:03:51.249126 2018] [mpm_event:notice] [pid 3730:tid 140047470462848] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 18:03:52.335467 2018] [mpm_event:notice] [pid 4815:tid 140214087751552] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 18:03:52.335607 2018] [core:notice] [pid 4815:tid 140214087751552] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 18:03:59.131805 2018] [mpm_event:notice] [pid 4815:tid 140214087751552] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 18:04:00.216384 2018] [mpm_event:notice] [pid 4918:tid 140288963467136] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 18:04:00.216562 2018] [core:notice] [pid 4918:tid 140288963467136] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 18:23:59.494573 2018] [mpm_event:notice] [pid 4918:tid 140288963467136] AH00491: caught SIGTERM, shutting down
    [Mon Apr 09 18:24:00.582049 2018] [mpm_event:notice] [pid 5302:tid 140040924424064] AH00489: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
    [Mon Apr 09 18:24:00.582221 2018] [core:notice] [pid 5302:tid 140040924424064] AH00094: Command line: '/usr/sbin/apache2'
    [Mon Apr 09 18:39:00.113290 2018] [mpm_event:notice] [pid 5302:tid 140040924424064] AH00491: caught SIGTERM, shutting down

在systemctl状态apache2,我得到

代码语言:javascript
复制
        ● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: active (running) since ma 2018-04-09 19:30:35 EEST; 6min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1509 ExecStart=/etc/init.d/apache2 start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/apache2.service
           ├─1672 /usr/sbin/apache2 -k start
           ├─1675 /usr/sbin/apache2 -k start
           └─1676 /usr/sbin/apache2 -k start

huhti 09 19:30:33 ossasecurity-desktop systemd[1]: Starting LSB: Apache2 web server...
huhti 09 19:30:33 ossasecurity-desktop apache2[1509]:  * Starting Apache httpd web server apache2
huhti 09 19:30:34 ossasecurity-desktop apache2[1509]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
huhti 09 19:30:35 ossasecurity-desktop apache2[1509]:  *
huhti 09 19:30:35 ossasecurity-desktop systemd[1]: Started LSB: Apache2 web server.

你还需要什么信息?我必须指出,在/var/www/目录中有一个index.html!

EN

回答 1

Server Fault用户

发布于 2018-04-09 17:26:27

上面共享的配置似乎是来自更大的conf的一个片段,或者是整个conf中包含的一个文件。如果您在“默认”vhost的某个地方有另一个conf,则不使用指定的"ServerName“或"ServerAlias”就无法浏览该vhost。

我怀疑您定义的vhost不是apache用来处理请求的vhost。

默认情况下,除非定义_default_ vhost,否则Apache将使用第一个被读取为默认的vhost配置。考虑到这一点,这就是为什么我总是用唯一的日志文件创建vhost的100%原因。它使这些事情更易于调试。

例如:

代码语言:javascript
复制
  DocumentRoot /blah/blah
  DirectoryIndex index.html
  ErrorLog ${APACHE_LOG_DIR}/default.error.log
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/default.access.log combined

和/或

代码语言:javascript
复制
  DocumentRoot /blah/blah
  ServerName blah.blah.blah
  DirectoryIndex index.html
  ErrorLog ${APACHE_LOG_DIR}/blah.blah.blah.error.log
  LogLevel warn
  CustomLog ${APACHE_LOG_DIR}/blah.blah.blah.access.log combined
票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/906794

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档