【问题标题】:Centos OS https shows apache2 default pageCentos OS https 显示 apache2 默认页面
【发布时间】:2022-01-27 21:08:34
【问题描述】:

我在 centos os 上设置我的项目,我已经安装了我的 ssl 证书并更新了我的 ssl.conf。我的项目可以使用http://test.com 访问,但是当我尝试访问https://test.com 时,我可以看到该站点是安全的,但它在页面中显示了默认的 apache。尽管我已经在我的 443 虚拟主机中指定了目录和文档根目录。是否有步骤或错误,任何建议或有用的链接将不胜感激。

我的代码如下所示:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
DocumentRoot "/var/www/html/strategy"
ServerName test.com/
ServerAlias www.test.com
<Directory "/var/www/html/strategy">
RewriteEngine on

# if (HTTP_ACCESS.contains('text/html') && file_not_exists(REQUEST_FILENAME))
    RewriteCond %{HTTP_ACCEPT} text/html
    RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^ index.html [last]

    # Any ressources loaded by index.html should behave correctly (i.e: Return 404 if missing)
    RewriteRule ^ - [last]

    Options Indexes FollowSymLinks
    Options Indexes FollowSymLinks
    AllowOverride None

    Order allow,deny
    Allow from all

</Directory>
</VirtualHost>


<VirtualHost *:443>
     ServerAdmin info@stratex.com
     ServerName www.test.com
     DocumentRoot "/var/www/html/strategy"

    <Directory "/var/www/html/strategy">
        DirectoryIndex index.html 
    Options FollowSymLinks
    AllowOverride All
    Require all granted
    </Directory>

     SSLEngine On
     SSLCertificateFile /home/mydir/certificates/public-cert.pem
     SSLCertificateKeyFile /home/mydir/certificates/priv-key.pem
     
</VirtualHost>

【问题讨论】:

    标签: apache server centos


    【解决方案1】:

    由于我有一个 ssl.conf 文件,我从 httpd.conf 文件中删除了端口 443 的 conf 文件,并使用这些详细信息在 ssl.conf 文件中使用端口 443 更新了虚拟主机,我的应用程序运行良好。

    <VirtualHost *:443>
         ServerAdmin info@stratex.com
         ServerName www.test.com
         DocumentRoot "/var/www/html/strategy"
    
        <Directory "/var/www/html/strategy">
            DirectoryIndex index.html 
        Options FollowSymLinks
        AllowOverride All
        Require all granted
        </Directory>
    
         SSLEngine On
         SSLCertificateFile /home/mydir/certificates/public-cert.pem
         SSLCertificateKeyFile /home/mydir/certificates/priv-key.pem
         
    </VirtualHost>
    

    【讨论】:

      猜你喜欢
      • 2013-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-01
      • 2016-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多