首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache web服务器问题

Apache web服务器问题
EN

Ask Ubuntu用户
提问于 2022-02-14 06:00:00
回答 1查看 257关注 0票数 0

在添加证书之前,我可以访问以下站点

http://website.com:4043/web/login

但是在添加证书之后,我无法使用https访问完整的URL。不过,我只能访问https://website.com

请给我支持。

EN

回答 1

Ask Ubuntu用户

发布于 2022-02-14 06:20:53

假设您正在运行一个现代版本的Ubuntu,您将希望确保您的Apache虚拟配置文件如下所示:

代码语言:javascript
复制
Listen 443
Listen 4043


    ServerName website.com

    SSLProxyEngine on
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key
    DocumentRoot /var/www/html



    ServerName website.com

    SSLProxyEngine on
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/server.crt
    SSLCertificateKeyFile /etc/ssl/private/server.key
    DocumentRoot /var/www/html

从这里开始,您可以设置一个快速的小.htaccess规则,以确保流量被正确地重定向到4043,而不是服务器默认的443。例如:

代码语言:javascript
复制
RewriteEngine on

# If the port isn't 4043
RewriteCond %{SERVER_PORT} !^4043$

# We redirect to the same address with the proper port
RewriteRule ^(.*)$ https://%{HTTP_HOST}:4043/$1 [R=301,L]

重要:不要简单地复制和粘贴这些东西。看课文,为你自己的环境做些调整,除了你以外,其他人都不知道。

票数 0
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1392787

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档