apache - Centos OS https 显示 apache2 默认页面

标签 apache server centos

我在 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>

最佳答案

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

关于apache - Centos OS https 显示 apache2 默认页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70869573/

相关文章:

java - 在java中使用JButton向客户端发送消息

java - 从服务器端的列表中删除不正确的用户

java - Tomcat 7 javax.el.E​​LException 异常

node.js - 在 Apache 反向代理上运行 Socket.io

centos - 域的 httpd.conf 文件在哪里? (Plesk、Apache、CentOS、专用服务器。)

java - SBT SCALA java.lang.ClassNotFoundException : javax. mail.Authenticator

java - 运行 python -m http.server XXXX 是否安全

linux - Mercurial 和第三方 hg-login 脚本的问题

centos - 为用户设置 Screen Cron

php - 如何在 Apache 2.4 上启用 mod_rewrite?