Eth*_*lle 4 mod-rewrite ssl nagios .htaccess centos6
我可能只需要一些额外的洞察力,因为我不知道我哪里出错了。我使用 SSL 证书来保护我们的 nagios 服务器。我们希望特别要求所有通过 nagios 的流量(如 2 个用户,哈哈)使用 SSL。
所以我想,哦,.htaccess 中的 mod_rewrite + 重写规则,对吗?
所以我进入 DocumentRoot 并做了一个 vi .htaccess(一个不存在),然后我输入了以下规则;
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://our.server.org/$1 [R,L]
Run Code Online (Sandbox Code Playgroud)
这绝对没有任何作用。纳达。
为什么..
注意: httpd.conf 中的 AllowOverride all 已开启。另外,我验证了该模块没有取消注释......但请注意,我找不到安装的 mod_rewrite 模块,所以我从另一台服务器复制了它并将它放在 modules/mod_rewrite.so 中。这很奇怪,因为它在 httpd.conf 文件中启用,但在模块中不存在......
我是坏人:(
这是我的整个重定向非 ssl VirtualHost:
<VirtualHost *:80>
ServerAdmin root@example.com
ServerName www.example.com
ServerAlias example.com
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
LogLevel warn
CustomLog /var/log/apache2/access.log vhost_combined
ErrorLog /var/log/apache2/error.log
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
这属于 Apache 配置而不是.htaccess
.
主要区别在于我们的RewriteCond
线路,你的%{SERVER_PORT} 80
和我的在哪里%{HTTPS} !=on
。
归档时间: |
|
查看次数: |
2538 次 |
最近记录: |