nginx重定向所有http请求到https
# vi sub.domain.conf
server{
listen 80;
server_name sub.domain.com;
return 301 https://$host$request_uri;
}
server{
charset utf-8;
listen 443 ssl;
ssl on;
ssl_certificate /usr/local/nginx/conf/cert/sub.domain.com.crt;
ssl_certificate_key /usr/local/nginx/conf/cert/sub.domain.com.key;
server_name sub.domain.com;
auth_basic "auth";
auth_basic_user_file /usr/local/nginx/conf/cert/pass_file;
access_log /home/wwwlogs/sub.domain.com.log;
error_log /home/wwwlogs/sub.domain.com.err;
location / {
proxy_pass http://127.0.0.1:99999;
}
}
分享到:
相关推荐
网络上很难找到非常详细的...本文档通过真实的实践经验,从安装OpenSSL和Nginx,到利用openssl生成证书,配置nginx的https(包括配置http请求转发到https)等,详细总结出nginx配置https的步骤,最终能帮助你配置成功。
nginx 伪静态 重定向
nginx待遇发给后端的请求是http协议,后端程序跳转获取到的协议是http,返回一个redirect(http header中带Location://www.jb51.net/aaa.html),浏览器收到location,跳转到了location指定的地方。 解决方法 解决...
http重定向到https使用了nginx的重定向命令。那么应该如何写重定向?之前老版本的nginx可能使用了以下类似的格式。 rewrite ^/(.*)$ http://domain.com/$1 permanent; 或者 rewrite ^ http://domain.com$request_...
nginx配置https反向代理到tomcat的http,包括windows版本和linux版本的软件下载,安装,配置等
主要介绍了nginx http重定向https配置说明的相关资料,需要的朋友可以参考下
nginx 301 302重定向跳转配置.docx
主要介绍了nginx强制使用https访问的方法(http跳转到https),具有一定的参考价值,感兴趣的小伙伴们可以参考一下。
应用场景:dashidan.com/image自动跳转到dashidan.com/folderName/image.nginx目录路径重定向的四种实现方式.修改root映射,通过Nginx rewrite内部跳转,设置别名alias映射实现,通过nginx的permanent 301绝对跳转实现....
1、地址重定向:是指当使用者浏览某个网址时,将他导向到另一个网址的技术。常用在把一串很长的网址,转成较短的网址。因为当要传播某网站时,常常因为网址太长,不好记忆;又有可能因为换了网路的免费网页空间,...
今天碰到一个问题,服务器上一个子域名的请求重定向到另一个子域名上面去了。查了一段时间发现这个问题只有在 HTTP 到 HTTPS 跳转的时候才会发生。大概是这样: 从 HTTP 的 sub2 子域名跳转到 HTTPS 的 sub1 子域名 ...
Nginx中http请求处理过程 有不少地方不是很明白 ,还望大家共同交流
Nginx配置http转https以及https访问http静态资源.docx
这时Nginx后台需要自动将Http请求转成Https的方式,这样就又能支持Http,又能保证通信安全了。 废话不多说,下面直接贴一个Nginx支持Http和Https的配置,是我的wordpres网站支持Https的配置,大家何以参考。 server...
修改之前,nginx的配置如下: upstream local_tomcat_wechat{ server 127.0.0.1:80 weight=2 fail_timeout=1s; } server { listen 443; server_name www.xxxx.com; error_log /nginx/log/...
nginx配置+https
主要介绍了详解Nginx中的重定向功能,Nginx是一款基于事务的无阻塞的高性能服务器,需要的朋友可以参考下