【问题标题】:Ubuntu Apache doesn't redirect http to httpsUbuntu Apache 不会将 http 重定向到 https
【发布时间】:2018-03-09 22:49:05
【问题描述】:

我使用 Apache/2.2.15 (unix) 我已经将服务器更改为在 https 上工作,它工作正常,除了一个小警告,服务器主机名是 example,证书 CN 是 example.domain,所以 HTTPS 标志上有红线。 我试图将 HTTP 重定向到 HTTPS,但它不起作用。 我读了很多,没有解决它。

我的 httpd.conf 文件(仅相关部分):

<virtualHost *:80>

ServerName name

RewriteEngine on
RewriteCond %{REQUEST_URI} ^/* [NC]
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
<VirtualHost>

我的 ssl.conf 文件配置了 virtualHost *:443 并且会按需发布。

更改后我的错误日志文件并重新启动httpd:

[error] Exception keyerror: keyerror(140406319183840,) in module 'threading' from '/usr/lib64/python2/threading.pyc' ignored
[notice] caucht SIGTERM, shutting down
[notice] suEXEC mechanism enabled (weapper: /usr/sbin/suexec)
[notice] Digest: generating secret for digest authentication...
[notice] Digest: done
[warn] mod_wsgi: compiled for paython/2.6.2
[warn] mod_wsgi:runtime using python/2.6.2

我从这个错误日志中得到的唯一信息是我没有文件 /usr/lib64/python2/threading.pyc

谢谢!

【问题讨论】:

  • 哪里说你没有threading.pyc?我看到来自threading.pyc 的警告说KeyError 在键140406319183840 上?
  • 我已经在文件系统中寻找过该文件,但它在文件系统中丢失了
  • 我不知道 mod_wsgi 是如何工作的,但是根据我看到的我感觉你确实有threading.pyc,否则错误应该不能说in module 'threading'
  • 我又检查了一遍,我没有。有人知道那个文件是什么吗?
  • 我们已经解决了这个问题!我们将其配置为监听 80 端口。谢谢大家!

标签: python apache redirect https


【解决方案1】:

你可以通过监听 80 端口来解决这个问题:

Listen 80 <VirtualHost *:80>

在@bogin @ratskin 的 cmets 中找到答案

【讨论】:

    猜你喜欢
    • 2019-11-08
    • 2019-12-17
    • 1970-01-01
    • 2013-09-27
    • 2016-02-04
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多