AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 413882
Accepted
Cameron Aziz
Cameron Aziz
Asked: 2012-08-03 20:16:27 +0800 CST2012-08-03 20:16:27 +0800 CST 2012-08-03 20:16:27 +0800 CST

无法启动 apache,说 html 文件夹不是目录

  • 772

当我尝试启动 httpd 时:

[root@cameronaziz www]# service httpd start
Starting httpd: Syntax error on line 292 of /etc/httpd/conf/httpd.conf:
DocumentRoot must be a directory
                                                           [FAILED]

我的配置的第 292 行:

DocumentRoot "/var/www/html"

并列出 www 目录:

[root@cameronaziz www]# ll
total 16
drwxr-xr-x. 2 root root 4096 Feb 13 14:33 cgi-bin
drwxr-xr-x. 3 root root 4096 Jul 11 21:03 error
drwxrwxrwx. 9 root 6226 4096 Aug  2 14:02 html
drwxr-xr-x. 3 root root 4096 Jul 11 21:17 icons

和

[root@cameronaziz ~]# ls -laZ /var/www/html/
drwxrwxrwx. apache 6226 unconfined_u:object_r:admin_home_t:s0 .
drwxr-xr-x. root   root system_u:object_r:httpd_sys_content_t:s0 ..
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 authorize.php
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 CHANGELOG.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 COPYRIGHT.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 cron.php
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 .gitignore
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 .htaccess
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 includes
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 index.php
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 INSTALL.mysql.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 INSTALL.pgsql.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 install.php
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 INSTALL.sqlite.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 INSTALL.txt
-rw-rw-r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 LICENSE.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 MAINTAINERS.txt
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 misc
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 modules
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 profiles
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 README.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 robots.txt
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 scripts
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 sites
-rw-r--r--. root   root unconfined_u:object_r:admin_home_t:s0 test.php
drwxr-xr-x.   6226 6226 unconfined_u:object_r:admin_home_t:s0 themes
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 update.php
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 UPGRADE.txt
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 web.config
-rw-r--r--.   6226 6226 unconfined_u:object_r:admin_home_t:s0 xmlrpc.php

我的配置有什么问题不会让 apache 启动?我正在运行 CentOS。

apache-2.2
  • 1 1 个回答
  • 5377 Views

1 个回答

  • Voted
  1. Best Answer
    quanta
    2012-08-04T00:56:46+08:002012-08-04T00:56:46+08:00
    drwxrwxrwx. apache 6226 unconfined_u:object_r:admin_home_t:s0 .
    

    您的 DocumentRoot 被设置为错误的安全上下文 (admin_home_t)。

    运行以下命令并重试:

    # chcon -R -h -t httpd_sys_content_t /var/www/html/
    
    • 3

相关问题

  • Apache Django Mod_Wsgi - 自动重新加载应用程序

  • Apache:对多个虚拟主机使用相同的目录指令

  • Apache 上的子域不工作 - 找不到服务器

  • PHP 作为 CGI 还是 Apache 模块?

  • 避免将某些丢失的文件记录到 Apache2 错误日志中

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve