【问题标题】:HTTPS giving 404 not found errorHTTPS 给出 404 未找到错误
【发布时间】:2016-08-05 06:28:56
【问题描述】:

我已在我的 bitnami 谷歌云主机上安装 SSL 认证。
证书已安装,甚至

我可以访问:

https://domain.com

但是当我尝试访问时

https://domain.com/xyz 

它给我 404 未找到错误

下面是我的binami.conf文件

<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
  SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"

  DocumentRoot "/opt/bitnami/apache2/htdocs/domain/public/"
  <Directory "/opt/bitnami/apache2/htdocs/htdocs/domain/public/">
    Options FollowSymLinks MultiViews
    AddLanguage en en
    LanguagePriority en
    ForceLanguagePriority Prefer Fallback

    AllowOverride All
    <IfVersion < 2.3 >
      Order allow,deny
      Allow from all
    </IfVersion>
    <IfVersion >= 2.3 >
      Require all granted
    </IfVersion>
  </Directory>

  # Error Documents
  ErrorDocument 503 /503.html

  # Bitnami applications installed with a prefix URL (default)
  Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
</VirtualHost>

谁能帮帮我,出了什么问题
更多信息
我正在使用带有 Bitnami LAMP 堆栈的谷歌云平台

【问题讨论】:

  • 但是你能不能访问http://domain.com/xyz 这是个问题,例如一个有效的 url,如果不是 SSL 没有区别。
  • 是的,它是一个有效的 URL,当我使用没有 https 的网站时,一切都在运行 find
  • 我们真的需要查看.conf&lt;VirtualHost *:80&gt; 文件,https 站点上可能缺少一些重写。

标签: php apache ssl google-cloud-platform bitnami


【解决方案1】:

&lt;VirtualHost _default_ *:80&gt; 中,您正在设置:

DocumentRoot "/opt/bitnami/apache2/htdocs/domainDIR/public/"

但是,在&lt;VirtualHost *:443&gt; 中,您正在设置:

DocumentRoot "/opt/bitnami/apache2/htdocs/domain/public/"

您的网络应用程序位于何处?两条路径应该是相同的。

【讨论】:

    【解决方案2】:

    @DusanBajic

    <VirtualHost _default_ *:80>
      DocumentRoot "/opt/bitnami/apache2/htdocs/domainDIR/public/"
      <Directory "/opt/bitnami/apache2/htdocs/domainDIR/public/">
        Options FollowSymLinks MultiViews
        AddLanguage en en
        LanguagePriority en
        ForceLanguagePriority Prefer Fallback
        AllowOverride All
        <IfVersion < 2.3 >
          Order allow,deny
          Allow from all
        </IfVersion>
        <IfVersion >= 2.3 >
          Require all granted
        </IfVersion>
      </Directory>
      # Error Documents
      ErrorDocument 503 /503.html
      Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
    </VirtualHost>
    

    【讨论】:

      【解决方案3】:

      只是猜测,但我认为 bitnami.conf 应该只针对 ssl 部分。

      # Default SSL Virtual Host configuration.
      
      <IfModule !ssl_module>
        LoadModule ssl_module modules/mod_ssl.so
      </IfModule>
      
      Listen 443
      SSLProtocol all -SSLv2 -SSLv3
      SSLHonorCipherOrder on
      SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH !aNULL !eNULL !LOW !3DES !MD5 !EXP !PSK !SRP !DSS !EDH !RC4"
      SSLPassPhraseDialog  builtin
      SSLSessionCache "shmcb:/opt/bitnami/apache2/logs/ssl_scache(512000)"
      SSLSessionCacheTimeout  300
      
      <VirtualHost _default_:443>
        DocumentRoot "/opt/bitnami/apache2/htdocs"
        SSLEngine on
      SSLCertificateFile "/opt/bitnami/apache2/conf/server.crt"
      SSLCertificateKeyFile "/opt/bitnami/apache2/conf/server.key"
      
        <Directory "/opt/bitnami/apache2/htdocs">
          Options FollowSymLinks MultiViews
          AddLanguage en en
          LanguagePriority en
          ForceLanguagePriority Prefer Fallback
      
          AllowOverride All
          <IfVersion < 2.3 >
            Order allow,deny                          
            Allow from all
          </IfVersion>
          <IfVersion >= 2.3 >
            Require all granted
          </IfVersion>
        </Directory>
      
        # Error Documents
        ErrorDocument 503 /503.html
      
        # Bitnami applications installed with a prefix URL (default)
        Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf"
      </VirtualHost>
      
      # Bitnami applications that uses virtual host configuration
      Include "/opt/bitnami/apache2/conf/bitnami/bitnami-apps-vhosts.conf"
      

      您应该将您的&lt;VirtualHost *:443&gt; 代码从上面(顶部)放入 /extras/httpd-ssl.conf 文件中。

      然后通过 Putty(或任何你使用的东西)重新启动 apache

      sudo /opt/bitnami/ctlscript.sh 重启 apache

      我会在这周的某个时候尝试对其进行测试并根据需要进行编辑(8^{D=

      【讨论】:

        【解决方案4】:

        一般来说,404 NOT FOUND 在这种情况下可以从 2 个位置中的 1 个提供服务。 Apache 服务器可能会使用404 进行响应,或者 Apache 接收到的请求被路由到应用程序并且应用程序服务于 404

        如果应用程序正在为404 NOT FOUND 提供服务,作为应用程序所有者,大概可以记录每个请求以查看此情况发生。由于您根本没有提到该应用程序,因此我们必须假设这不是源并调查 Apache 服务器。

        您为 HTTP (:80) 和 HTTPS (:443) 提供的配置使用&lt;Directory ""&gt; 提供静态资源。但是,@Juan 提到的目录和DocumentRoot 的路径在 HTTP 和 HTTPS 之间是不同的。

        "/opt/bitnami/apache2/htdocs/domainDIR/public/" != "/opt/bitnami/apache2/htdocs/domain/public/"

        如果您没有 2 个不同的目录来提供基于 HTTP(S) 的静态资源,那么这很可能是导致 404 的原因。通过 HTTPS 提供服务时,Apache 找不到 "/opt/bitnami/apache2/htdocs/domain/public/"

        请注意,目前,Google Cloud deploys with Apache 2.4.25 上的 Bitnami LAMP 图像不应满足 &lt;IfVersion &lt; 2.3&gt; 标准。如果在其他地方使用相同的配置,保留它是安全的。

        【讨论】:

          猜你喜欢
          • 2014-05-06
          • 2019-11-20
          • 2020-08-29
          • 2021-06-12
          • 2016-01-06
          • 1970-01-01
          • 2021-12-23
          • 2015-10-04
          • 1970-01-01
          相关资源
          最近更新 更多