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 / 问题 / 1011209
Accepted
hbquikcomjamesl
hbquikcomjamesl
Asked: 2020-04-07 16:22:40 +0800 CST2020-04-07 16:22:40 +0800 CST 2020-04-07 16:22:40 +0800 CST

现有 httpd 服务器上的新虚拟主机:默认情况下无法显示 index.html

  • 772

我有一个现有的 Apache httpd 服务器。所有现有的虚拟主机都有 php 登录页面(即 index.php)。然而,新版本有一个简单的、老式的 html 登录页面(即 index.html)。

如果我在 url 中明确指定它,我可以获得 html 登录页面,例如http://qux.baz.com/index.html(不是真正的 URL)。

但是,如果我没有在 url 中明确指定登录页面,例如http://qux.baz.com,它会立即重定向到https://www.qux.baz.com,这会失败。

我尝试在 qux.baz.conf 文件中放置一个 DirectoryIndex 指令;没有效果,即使重新启动 httpd。

我在任何地方找到的唯一现有 DirectoryIndex 指令是 php.conf 中的指令。我尝试将“index.html”添加到它的末尾。也没有效果。

我的新 conf 文件如下所示(URL 已更改以保护无辜者):

<VirtualHost *:80>
ServerName qux.baz.com
ServerAlias corge.baz.com
DocumentRoot /var/www/html/test
ServerAdmin [email protected]
<Directory /var/www/html/test>
AllowOverride All
</Directory>
# RewriteEngine on
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>

(请注意,我故意注释掉与重写有关的所有内容)

并且 httpd -S 输出(再次,更改 URL 以保护无辜者)看起来像

*:443                  is a NameVirtualHost
         default server www.foo.com (/etc/httpd/conf.d/foo-le-ssl.conf:2)
         port 443 namevhost www.foo.com (/etc/httpd/conf.d/foo-le-ssl.conf:2)
                 alias foo.com
         port 443 namevhost ip-172-32-29-49.ec2.internal (/etc/httpd/conf.d/ssl.conf:56)
         port 443 namevhost www.plugh.com (/etc/httpd/conf.d/plugh-le-ssl.conf:2)
                 alias plugh.com
         port 443 namevhost www.baz.com (/etc/httpd/conf.d/baz-le-ssl.conf:2)
                 alias baz.com
         port 443 namevhost www.bar.com (/etc/httpd/conf.d/bar-le-ssl.conf:2)
                 alias bar.com
*:80                   is a NameVirtualHost
         default server www.foo.com (/etc/httpd/conf.d/foo.conf:1)
         port 80 namevhost www.foo.com (/etc/httpd/conf.d/foo.conf:1)
                 alias foo.com
         port 80 namevhost www.plugh.com (/etc/httpd/conf.d/plugh.conf:1)
                 alias plugh.com
         port 80 namevhost www.baz.com (/etc/httpd/conf.d/baz.conf:1)
                 alias baz.com
         port 80 namevhost www.bar.com (/etc/httpd/conf.d/bar.conf:1)
                 alias bar.com
         port 80 namevhost qux.baz.com (/etc/httpd/conf.d/qux.baz.conf:1)
                 alias corge.baz.com
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex authdigest-opaque: using_defaults
Mutex watchdog-callback: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex ssl-stapling-refresh: using_defaults
Mutex authdigest-client: using_defaults
Mutex lua-ivm-shm: using_defaults
Mutex ssl-stapling: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex ssl-cache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default 
Mutex mpm-accept: using_defaults
Mutex cache-socache: using_defaults
PidFile: "/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48
Group: name="apache" id=48

我显然在这里做错了什么,但我一点也不知道是什么。

httpd apache2
  • 1 1 个回答
  • 36 Views

1 个回答

  • Voted
  1. Best Answer
    hbquikcomjamesl
    2020-04-08T09:34:43+08:002020-04-08T09:34:43+08:00

    我真的无法相信这个[亵渎]!

    我的浏览器正在这样做[亵渎]!

    当http://qux.baz.com的虚拟主机不存在或默认情况下不提供 index.html时,他们会记得他们去了哪里,并且他们正在 [亵渎] 将我重定向到一个不存在的 URL!

    我想没有人知道告诉浏览器永远记住重定向的方法吗?

    • 0

相关问题

  • 当 httpd 被赋予错误的端口号时会发生什么?

  • Apache httpd 集群日志记录

  • HTTP -> HTTPS 重定向与 OpenBSD 的 httpd [关闭]

  • PHP 网络服务器的最快选择

  • 什么会导致 Apache HTTPD 无限期地使用 100% CPU

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