简体   繁体   English

Ubuntu Apache不会将http重定向到https

[英]Ubuntu Apache doesn't redirect http to https

im using Apache/2.2.15 (unix) i had change the server to work on https, its work fine except a small warning, the server hostname is example and the cert CN is example.domain , so the HTTPS sign has red line on it. 即时通讯使用Apache / 2.2.15(unix)我已将服务器更改为可以在https上工作,除了有一个小警告外,它的工作都很好,服务器的主机名是example,而证书CN是example.domain,所以HTTPS标志上有红线它。 im trying to redirect HTTP to HTTPS, but it's doesn't work. 我试图将HTTP重定向到HTTPS,但这是行不通的。 i had read a lot, nothing solved it. 我读了很多书,没有什么解决的。

my httpd.conf file (only relevant part) : 我的httpd.conf文件(仅相关部分):

<virtualHost *:80>

ServerName name

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

my ssl.conf file is configured with virtualHost *:443 and ill post it on demand. 我的ssl.conf文件配置了virtualHost *:443,并且无法按需发布。

my error log file after the change and restart the httpd: 更改后出现我的错误日志文件,然后重新启动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

the only thing i got from this error log is that i dont have the file /usr/lib64/python2/threading.pyc 我从此错误日志中获得的唯一信息是我没有文件/usr/lib64/python2/threading.pyc

thank you! 谢谢!

You can solve this problem by listening on port 80 like so: 您可以通过侦听端口80来解决此问题,如下所示:

Listen 80 <VirtualHost *:80>

Answer found in the comments from @bogin @ratskin 在@bogin @ratskin的评论中找到答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM