<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>nginx on 明哥技术笔记</title>
    <link>http://test.mylass.com/series/nginx/</link>
    <description>Recent content in nginx on 明哥技术笔记</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>明哥技术笔记</copyright>
    <lastBuildDate>Tue, 19 Jul 2022 00:00:00 +0000</lastBuildDate><atom:link href="http://test.mylass.com/series/nginx/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>nginx if判断实现逻辑运算 AND 和 OR 的方法</title>
      <link>http://test.mylass.com/linux/nginx-if-and-or/</link>
      <pubDate>Tue, 19 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>http://test.mylass.com/linux/nginx-if-and-or/</guid>
      <description>
        
          
            nginx if判断中实现 AND 和 OR 的逻辑的方法
          
          
        
      </description>
    </item>
    
    <item>
      <title>nginx反向代理</title>
      <link>http://test.mylass.com/linux/nginx-proxy/</link>
      <pubDate>Wed, 08 May 2019 00:00:00 +0000</pubDate>
      
      <guid>http://test.mylass.com/linux/nginx-proxy/</guid>
      <description>
        
          
            在配置文件中定义，一般是nginx.conf
场景：如，有两个网站，使用不同的服务器来提供的，但是我的公网IP只有一个。 现在把这个公网IP的80端口映射到一台转发的nginx上面，再在这一台上面配置反向代理，就可以实现。
如A网站的地址是 192.168.10.23 域名是 www.example.com B网站的地址是 192.168.10.24 域名是 www.test.com
在 nginx 的配置反向代理如下
1server { 2 listen 80; 3 server_name www.example.com; 4 5 location / { 6 proxy_pass http://192.168.10.23; 7 } 8} 9 10server { 11 listen 80; 12 server_name www.test.com; 13 14 location / { 15 proxy_pass http://192.168.10.24; 16 } 17} 主要是 server_name 指定域名，以及 proxy_pass 指定后端的服务器
启用 http 的 ssl 配置 1server { 2 listen 443 http2;	# 监听的端口， https的默认端口为443 3 server_name www.
          
          
        
      </description>
    </item>
    
    <item>
      <title>nginx站点配置</title>
      <link>http://test.mylass.com/linux/nginx/</link>
      <pubDate>Sun, 09 Dec 2018 00:00:00 +0000</pubDate>
      
      <guid>http://test.mylass.com/linux/nginx/</guid>
      <description>
        
          
            使用 docker 容器，使用 docker-compose 管理
compose 目录 /root/nginx-container
nginx 配置文件：
1/root/nginx-container/conf/nginx.conf 2/root/nginx-container/conf.d/*.conf SSL 证书存放路径，在此目录再以项目或站点名称创建文件夹存放
1/root/nginx-container/ssl/ 目前 sxsc 站点的配置文件 /root/nginx-container/conf/conf.d/sxsc.ltd.conf ， SSL 证书存放路径 /root/nginx-container/ssl/sxsc.ltd/ .
添加新站点 在 /root/nginx-container/conf/conf.d/ 目录下创建一个新文件，并以 .conf 结尾， 可以用站点名称命名，如：www.sxsc.com.conf, 配置文件内容，可参考以下
1server { 2 listen 80; # 监听端口 3 server_name sxsc.ltd www.sxsc.ltd; # 域名、主机名 4 # 以下是 http 跳转到 https，并返回 HTTP 301 永久重写向. 5 # 适合开启了https的站点，若用户从https访问则自动跳转到https 6 location / { 7 rewrite ^/(.*)$ https://www.sxsc.ltd/$1 permanent; 8 } 9} 10server { 11 listen 443 ssl; # 监听端口，并开启 SSL 12 server_name sxsc.
          
          
        
      </description>
    </item>
    
  </channel>
</rss>
