当前Nginx已经反向代理了两个网站,分别是基于Windows的IIS和Linux的Apach服务器,提供网页服务。

现在有新项目的网页需要对外提供服务,需要在代理服务器上增加另外一个网站,使用HTTPS访问以及HTTP自动跳转HTTPS。由于新网页是静态页面,所以使用Docker部署在Nginx代理服务器上。相关的certificates是通过let's encrypt来获取的,都是单独的证书,没有申请通配符形式的证书。

在Nginx代理端部署SSL证书即可,后端不需要部署SSL也可以实现HTTPS访问。

Nginx反向代理多域名的HTTP和HTTPS服务的实现

Nginx代理服务器配置:

worker_processes auto;

error_log /var/log/nginx/error.log warn;
pid  /var/run/nginx.pid;

events {
 worker_connections 1024;
}

http {
 include  /usr/local/nginx/conf/mime.types;
 default_type application/octet-stream;

 log_format main '$remote_addr - $remote_user [$time_local] "$request" '
      '$status $body_bytes_sent "$http_referer" '
      '"$http_user_agent" "$http_x_forwarded_for"';

 access_log /var/log/nginx/access.log main;

 sendfile  on;
 tcp_nopush  on;
 tcp_nodelay  on;

upstream dx.exzel.co.nz {

 server 127.0.0.1:8080;
}

upstream mybusiness.exzel.co.nz {

 server 192.168.1.252:443;
}

server {
 listen 80;
 server_name dx.exzel.co.nz;
 rewrite ^(.*) https://dx.exzel.co.nz permanent;
}
server {
 listen 443;
 server_name dx.exzel.co.nz;
 ssl on;
 ssl_certificate /etc/letsencrypt/live/dx.exzel.co.nz/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/dx.exzel.co.nz/privkey.pem;
 ssl_session_timeout 5m;
 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;
 access_log /var/log/nginx/ccieerror.log ;
 location / {
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;

      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_pass http://dx.exzel.co.nz;

 }
}

server {
 listen 80;
 server_name mybusiness.exzel.co.nz;
 rewrite ^(.*) https://mybusiness.exzel.co.nz permanent;
}
server {
 listen 443;
 server_name mybusiness.exzel.co.nz;
 ssl on;
 ssl_certificate /etc/letsencrypt/live/mybusiness.exzel.co.nz/fullchain.pem;
 ssl_certificate_key /etc/letsencrypt/live/mybusiness.exzel.co.nz/privkey.pem;
 ssl_session_timeout 5m;
 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
 ssl_prefer_server_ciphers on;
 access_log /var/log/nginx/mybusiness.log ;
 location / {
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;

      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_pass https://mybusiness.exzel.co.nz;

 }
}

server {
 listen 80;
 server_name www.empnz.co.nz empnz.co.nz;
  location / {
    proxy_pass http://192.168.1.15 ;
    }
 }

}
华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?