标签: https

将 HTTPS 重定向到 HTTP,特定 URL 除外

我们想将所有 HTTPS 流量重定向到 HTTP,除了特定的 URL /user/login

到目前为止,我们有:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^user/login(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
Run Code Online (Sandbox Code Playgroud)

但它会导致重定向循环,当它重定向回 HTTP 时

https .htaccess redirect apache-2.2

1
推荐指数
1
解决办法
2万
查看次数

Apache 重定向到 IP 地址(非 URL)

我一直在尝试通过将以下行添加到文件中来将 Web 流量从HTTP重定向到HTTPShttpd.conf

Redirect permanent / https://100.100.100.100
Run Code Online (Sandbox Code Playgroud)

但无济于事。浏览器响应是Firefox has detected that the server is redirecting the request for this address in a way that will never complete

我知道它适用于域名,但我的服务器不使用域名。有什么办法可以解决这个问题/我做错了什么。

ip https redirect apache-2.2

1
推荐指数
1
解决办法
1万
查看次数

无域子域的 SSL 证书

我的 Intranet 中有一个网络服务器,可以通过subdomain.domain.com 简单地访问它subdomain。创建的 SSL 证书会在subdomain.domain.com我仅subdomain通过 https访问时立即产生警告。

知道如何解决这个问题吗?(是的,我对 ssl 服务器配置不太了解 :-)

ssl certificate https subdomain

1
推荐指数
1
解决办法
637
查看次数

Nginx 未知的“https”变量

我今天早上醒来发现我一直在自学的新 Nginx 服务器不再为网站提供服务。看起来这是因为 Nginx 不再运行。但是,当我尝试启动它时,出现此错误:

Starting nginx: nginx: [emerg] unknown "https" variable
                                                           [FAILED]
Run Code Online (Sandbox Code Playgroud)

现在据我所知,没有任何变化,昨天运行良好,但到目前为止我没有查到任何帮助我找到解决方案的方法。

如果我运行 service nginx restart ,我会得到以下信息:

nginx: [emerg] unknown "https" variable
nginx: configuration file /etc/nginx/nginx.conf test failed
Run Code Online (Sandbox Code Playgroud)

到目前为止,我已经找到了关于此的所有内容,例如这里和其他一些地方:http : //www.howtoforge.com/forums/showthread.php? t =60733说要注释掉但是,fastcgi_params 一开始我就没有这些行。

我也试过注释掉对 https 的引用只是为了看看会发生什么,但它似乎没有任何区别。

我的 Nginx.conf 文件是:

user              nginx;
worker_processes  1;

#error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" …
Run Code Online (Sandbox Code Playgroud)

nginx https magento

1
推荐指数
1
解决办法
2万
查看次数

端口 80 到 443 的全局重定向

我想设置我的 linux box,以便任何访问端口 80 的东西都会被告知询问 443 端口。我希望它与域、IP 或任何可能存在的特定细节无关。如果可以请求端口 80,则应该告诉它不。我们在 443 上这样做。

我将在 443 上使用 Apache,因此可以很容易地将其绑定到 80,但不要认为解决方案必须在端口 80 上包含 Apache。

需要明确的是,我正在寻找一种无需更改虚拟主机的解决方案。我了解可以通过继承传递的全局重定向。这需要更改 vhost。我正在寻找更全面、更不容易出现“哎呀,我忘了那条线,现在端口 80 暴露了我的未加密数据”的东西。

你会如何着手解决这个问题?iptables、apache、带有 netcat 的自定义 shell 脚本和一些使其成为 SSL 的魔法?

https redirect shell-scripting apache-2.2

1
推荐指数
1
解决办法
2万
查看次数

强制 HTTPS 时重定向循环

我正在使用以下内容在我的主网站上强制使用 HTTPS。

### Force SSL
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Run Code Online (Sandbox Code Playgroud)

如果你想查看完整的 htaccess 文件,我把它放在下面:

<IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /

    ### Blacklist via Referrers

    RewriteCond %{HTTP_REFERER} removed\.net [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.net [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.sx [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.com [NC,OR]
    RewriteCond %{HTTP_REFERER} removed\.org [NC]
    RewriteRule ^(.*)$ - [F,L]

    ### Force SSL
    #RewriteCond %{HTTPS} !=on
    #RewriteRule …
Run Code Online (Sandbox Code Playgroud)

ssl https .htaccess amazon-elb

1
推荐指数
2
解决办法
2万
查看次数

使用“mode tcp”时如何根据URI选择不同的后端

我正在使用 haproxy 版本 1.6.2

我已经使用下面的配置启用了 http2,我需要使用“模式 tcp”。但是一旦我从“模式 http”切换到“模式 tcp”,我就无法使用 acl path_beg

frontend websocks
    mode tcp
    bind *:443 ssl crt /etc/certs/domain.pem alpn h2,http/1.1 ciphers EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH; no-sslv3
    timeout client 1h
    acl is_api path_beg /api
    acl is_xmpp path_beg /chat
    use_backend api_backend if is_api
    use_backend xmpp_backend if is_xmpp
    use_backend fe_public_tcp if { ssl_fc_alpn -i h2 }
    default_backend fe_public

fe_public
    server fe1 localhost:444 weight 1 maxconn 4096 check inter 10000 ssl verify none        

fe_public_tcp
    mode tcp
    server fe1 localhost:445

api_backend
    server api1 localhost:9966

xmpp_backend
    server …
Run Code Online (Sandbox Code Playgroud)

http https tcp haproxy

1
推荐指数
1
解决办法
2761
查看次数

有没有办法在 GCE HTTPS 负载均衡器中至少禁用 TLS 1.0?

我正在尝试通过 Trustwave pci DSS 扫描,但我不能,因为它在“支持 TLSv1.0”中失败,我认为问题出在 GCE HTTPS 负载均衡器中,它默认启用 TLSv 1.0、1.1 和 1.2(https:/ /cloud.google.com/compute/docs/load-balancing/http/#tls_support)。我已经使用 openssl 和 cipherscan ( https://github.com/jvehent/cipherscan ) 在本地测试了我的实例,在任何一个中我都只能使用 TLSv1.2 密码获得连接。我尝试使用 GCE HTTS 负载均衡器的公共 ip 使用相同的工具,我可以使用 TLSv1、TLSv1.1、TLSv1.2 进行连接。

https ssl-certificate google-compute-engine google-cloud-platform

1
推荐指数
1
解决办法
2384
查看次数

Nginx https 和非 www 导致许多重定向循环

我正在尝试做以下事情

  • 强制 www. 在我的网址中
  • 301重定向到https

当我访问 www.example.com 时,我收到太多重定向错误。当我去example.com时,它工作正常。

不知道我哪里出错了。下面是我的服务器块代码。

server {
    server_name  example.com www.example.com;
    return 301 https://www.example.com$request_uri;
}    


server {
    server_name www.mydomain.com
    ...
}
Run Code Online (Sandbox Code Playgroud)

nginx https

1
推荐指数
1
解决办法
679
查看次数

SSL 在域上,但不在子域上

我有一个在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)

ubuntu ssl https apache2

1
推荐指数
1
解决办法
566
查看次数