Centos OS https显示apache2默认页面

chhqkbe1  于 2022-11-23  发布在  Apache
关注(0)|答案(1)|浏览(150)

我正在Centos操作系统上设置我的项目,我已经安装了我的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>
von4xj4u

von4xj4u1#

由于我有一个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>

相关问题