在浏览器的 url 栏中键入 localhost 时,它会正确重定向到https://localhost,但是我的代码中用于加载文件的所有调用http都不会被重定向或重写到https. 例如:
<link rel="stylesheet" type="text/css" href="http://static/css/colwidth.min.css">
Run Code Online (Sandbox Code Playgroud)
我Redirect permanent / https://localhost/在 Apache 配置文件VirtualHost部分中尝试过RewriteRule,我也尝试过.htaccess
Firefox我得到的错误是:
阻止加载混合活动内容“
http://static/css/colwidth.min.css”
我将不胜感激帮助了解如何与做既Apache的配置和.htaccess(我知道.htaccess是不是首选方法-但我还是想知道为什么它不工作)
网址:
<VirtualHost *:80>
ServerAdmin me@localhost
DocumentRoot "D:/Website/path/to/root"
ServerName localhost
Redirect permanent / https://localhost/
<Directory "D:/Website/path/to/root">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require ip 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin me@localhost
DocumentRoot "D:/Website/path/to/root"
ServerName …Run Code Online (Sandbox Code Playgroud) 例如,当我浏览
http://example.com/foo?x=1&y=2
nginx 将我重定向到
https://example.com/foo?x=1&y=2?x=1&y=2
现在,如果我继续重定向,我会得到
https://example.com/foo?x=1&y=2?x=1&y=2?x=1&y=2?x=1&y=2
它不断加倍参数,不知道我做错了什么。
我的 nginx 配置:
server {
listen 80;
listen 443 ssl;
server_name {{ .SERVER_NAME }} www.{{ .SERVER_NAME }};
ssl_certificate /etc/ssl/nginx.crt;
ssl_certificate_key /etc/ssl/nginx.key;
if ($http_x_forwarded_proto != "https") {
rewrite ^(.*)$ https://$server_name$REQUEST_URI permanent;
}
# Nginx will reject anything not matching /
location / {
# Reject requests with unsupported HTTP method
if ($request_method !~ ^(GET|POST|HEAD|OPTIONS|PUT|DELETE|PATCH)$) {
return 405;
}
# Only requests matching the whitelist expectations will
# get sent to the application server …Run Code Online (Sandbox Code Playgroud) 我有 ubuntu 16.04,我在 apache2 mysite.dev 文件中设置了虚拟主机 /etc/apache2/sites-available/mysite.conf
<VirtualHost *:80>
ServerName mysite.dev
ServerAlias *.mysite.dev
DocumentRoot /var/www/mysite
<Directory /var/www/mysite>
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
它工作正常,直到昨天,我都能够在 Firefox 和 chrome 浏览器中通过链接http://mysite.dev/访问我的网站,但昨天我运行了以下升级命令
sudo apt-get upgrade
Run Code Online (Sandbox Code Playgroud)
重新启动后,它开始将我的应用程序重定向到httpsie https://mysite.dev/并显示
ERR_CONNECTION_REFUSED
Run Code Online (Sandbox Code Playgroud)
出于显而易见的原因
请注意:我不想要修复ERR_CONNECTION_REFUSED而是我希望我的网站开始工作http并停止将其重定向到https浏览器,
我有以下版本
另请注意,我正在运行 PHP 7.0 Magento …
我刚刚开始学习 nginx 和 SSL,并且一直在尝试不同的配置。我有两个服务器块,如下所示:
server{
listen 443 ssl http2;
server_name www.a.com;
ssl_certificate a.crt;
ssl_certificate_key a.key;
....
}
server{
listen 443 ssl ;
server_name www.b.com;
ssl_certificate b.crt;
ssl_certificate_key b.key;
....
}
Run Code Online (Sandbox Code Playgroud)
在使用 www.a.com 作为我的 SNI 通过 openssl s_client 连接到 nginx 后,我使用 Host: www.b.com 发送了一个 GET 请求,它仍然有效。这是预期的吗?有人可以帮助我了解 nginx 的行为吗?
在我的Plesk web管理版我只是激活HSTS我的主要领域www.domain.tld有
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Run Code Online (Sandbox Code Playgroud)
ssllabs.com上的测试表明一切正常。问题是我的子域 ( subdomain.domain.tld)。如果我在 ssllabs 上测试我的子域,它会说没有激活 HSTS。
我应该包括标题吗
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
Run Code Online (Sandbox Code Playgroud)
在我的子域上,还是在我的主域上实现就足够了?
我认为通过添加includeSubDomains不需要在子域上显式添加它。
我有一个在https://www.example.org/上运行的网站, 我打算创建http://games.example.com/ [无 SSL]。
我在 Ubuntu 16 服务器上运行 Apache 2。
我希望子域保持 http,主域保持 https。我该怎么办?
目前设置如下:
000-default.conf:
<VirtualHost *:80>
ServerName www.example.com
Redirect permanent "/" "https://www.example.com/"
#SSLProtocol all -SSLv2 -SSLv3
ServerAdmin contact@example.com
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName games.example.com
ServerAdmin contact@example.com
DocumentRoot /var/www/games
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerName planets.example.com
ServerAdmin contact@example.com
DocumentRoot /var/www/2moons
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
默认 ssl/conf:
<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin contact@example.com
ServerName www.example.com
DocumentRoot /var/www/html …Run Code Online (Sandbox Code Playgroud) 我的服务器既运行我的公共 Web 服务器,又运行本地服务器。本地服务器在333端口,我用了很长时间的无效证书,但我希望它正确配置,所以我做了自己的CA,在我的机器上安装了root权限,所以它不会给我“自签名”证书错误,为我的服务器创建证书,设置 apache2,但现在出现 CN 错误。我尝试了几个 CN 变体,我尝试了 server.home:333、server.home 和 server.home:*,但没有运气。甚至有可能这样做吗?
我有来自sslforfree的 SSL 证书。我有ca-bundle,certificate和它的private钥匙。
我想为不同的子域创建自己的证书。我希望以某种方式,我可以以某种方式用我现有的证书签署该证书,它会通过浏览器和邮件客户端以及其他人所做的所有 ssl 检查。
我遵循了几十个教程,但要么我错过了一个重要的细微差别,要么这些教程不是我想要的。
任何人都可以帮助我,我如何使用opensslfrom签署我的新证书CentOS 7?
我通过 AWS Route 53 拥有一个域,
主域通过letsencrypt方法得到保护,但不适用于任何通配符/子域...
我尝试使用*.example.com域和记录中的 DNS TXT 验证方法重做证书。这适用于我的端点,这些端点被 GeoDNS 路由到它们的特定实例,即fr.example.com和us.example.com...但是现在当我转到我的主域时,example.com它现在说它不安全(不再),并且我的大部分代码引用了这个主域错误,因为"invalid cert".
当我通过 Chrome 浏览器加载这个主域时,它报告“不安全”,当我点击它时,看到它,Certificate: (Not Secure)我会点击它,弹出详细信息,显示我的*.example.com域,但亮绿色表示该域是安全的。……?
在 Safari 中它说 *.example.com certificate name does not match input.
任何想法出了什么问题?如何在通配符也受到保护的情况下保护我的主域?