zoukankan      html  css  js  c++  java
  • 网站设置二级域名的nginx配置

    nginx的配置如下

    upstream myblog {
      server 127.0.0.1:8000;
    }
    upstream myreport{
      server 127.0.0.1:3000;
    }
    
    server {
        listen 443 ssl;
        server_name www.blog.xiaozhumaopao.com;  
        ssl_certificate cert/3063067_xiaozhumaopao.com.pem;   
        ssl_certificate_key cert/3063067_xiaozhumaopao.com.key;   
        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; 
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Nginx-Proxy true;
            proxy_set_header X-Forwarded-Host $server_name;
    
            proxy_pass http://myblog;    
            proxy_redirect off;
        }
        location ~* ^.+.(jpg|jpeg|gif|png|ico|css|js|pdf|txt|html){
          root /home/zyl/www/website/myblog/current/public;
        }
    
    }
    server {
        listen 80;
        server_name www.blog.xiaozhumaopao.com;   
        rewrite ^(.*)$ https://$host$1 permanent;  #设置这里访问http协议 也会自动跳转到 https协议
        location / {
            index index.html index.htm;
        }
    }
    
    server {
        listen 443 ssl;
        server_name www.report.xiaozhumaopao.com;  
        ssl_certificate cert/3063067_xiaozhumaopao.com.pem;   
        ssl_certificate_key cert/3063067_xiaozhumaopao.com.key;   
        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; 
        location / {
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Nginx-Proxy true;
            proxy_set_header X-Forwarded-Host $server_name;
    
            proxy_pass http://myreport;    
            proxy_redirect off;
        }
        location ~* ^.+.(jpg|jpeg|gif|png|ico|css|js|pdf|txt|html){
          root /home/zyl/www/website/myReport/current/public;
        }
    
    }
    server {
        listen 80;
        server_name www.report.xiaozhumaopao.com;   
        rewrite ^(.*)$ https://$host$1 permanent; 
        location / {
            index index.html index.htm;
        }
    }
  • 相关阅读:
    初识sed和gwak
    USB驱动程序设计
    linux-usb软件系统架构
    CSS基础 布局
    CSS基础 样式属性
    CSS基础 样式分类、选择器
    HTML基础 页面效果(标题图标、锚点、插入音乐,视频、滚动效果、嵌入网页)
    HTML基础 常用标记
    HTML基础 表单
    HTML基础 初识 HTML(整体结构 文字 图片 表格 超链接)
  • 原文地址:https://www.cnblogs.com/xiaozhumaopao/p/12919947.html
Copyright © 2011-2022 走看看