<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>linux on 明哥技术笔记</title>
    <link>http://test.mylass.com/tags/linux/</link>
    <description>Recent content in linux on 明哥技术笔记</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>明哥技术笔记</copyright>
    <lastBuildDate>Thu, 19 Sep 2019 00:00:00 +0000</lastBuildDate><atom:link href="http://test.mylass.com/tags/linux/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>alpine raspi 安装</title>
      <link>http://test.mylass.com/linux/alpine-raspi-install/</link>
      <pubDate>Thu, 19 Sep 2019 00:00:00 +0000</pubDate>
      
      <guid>http://test.mylass.com/linux/alpine-raspi-install/</guid>
      <description>
        
          
            参考 https://xts.so/linux/install-the-alpine-linux-on-raspberry-pi-zero-w.html
运行脚本
1setup-alpine 在安装的过程中，会提示你设置键盘布局、设置 WiFi 网络、设置时区、设置时间同步程序、设置apk软件源，设置root密码等等，按向导提示安装即可。
如果是普通安装，Alpine Linux 将会把整个系统安装到 FAT32 启动分区中，每次启动电脑的时候，会自动创建一个内存盘作为根分区。这种默认的安装方式比较简单，但却让 Zero W 本来就有限的内存显得更加捉襟见肘。
sys 模式
于是我选择了另一种安装方式—— sys 模式——将整个系统安装到一个 ext4 分区中。这样不需要内存盘作为根分区，可以节省出保贵的内存，也能让系统更可靠。请注意使用这种安装方式，在安装向导中需在 save config 和 save cache 步骤的提示中输入 none
走完setup-alpine脚本之后，我们还需要安装 ext4 文件系统的支持，这部分需要联网下载安装。
使用fdisk将剩余的空间划分 1fdisk /dev/mmcblk0 2	n 3	p 4	2 5	w 6	# 起始位置和结束位置，注意看原来的分区 安装 ext2/3/4 文件系统支持 1apk update 2apk add e2fsprogs 格式化之前创建的分区 1mkfs.ext4 /dev/mmcblk0p2 # 如果提示找不到，需要重启系统 把格式化好的分区挂载出来 1mount /dev/mmcblk0p2 /mnt 使用 setup-disk 安装系统 1setup-disk -m sys /mnt #因为setup-disk脚本还不太完善，安装过程中可能会提示一些错误，忽略即可。 清理用不到的文件 1mount -o remount,rw /dev/mmcblk0p1 2 3rm -f /media/mmcblk0p1/boot/* 4cd /mnt 5rm boot/boot 将启动镜像和 Alpine Linux 的init ram移动到 FAT32 分区中的正确位置 1mv boot/* /media/mmcblk0p1/boot/ 2rm -Rf boot # 删除 ext4 分区中的 boot 目录 3mkdir media/mmcblk0p1 # 下次重启后 FAT32 分区的新挂载点 建立一个软链，这样以后升级系统后无需人工复制到 FAT32 分区中。不用担心错误提示 1ln -s media/mmcblk0p1/boot boot 更新/etc/fstab分区挂载配置 1echo &amp;#34;/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0&amp;#34; &amp;gt;&amp;gt; etc/fstab 2sed -i &amp;#39;/cdrom/d&amp;#39; etc/fstab # 显示树莓派上没有光驱 3sed -i &amp;#39;/floppy/d&amp;#39; etc/fstab # 也没有软驱 
          
          
        
      </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>
    
    <item>
      <title>linux开机自动启动</title>
      <link>http://test.mylass.com/linux/linux-auto-start/</link>
      <pubDate>Mon, 06 Mar 2017 00:00:00 +0000</pubDate>
      
      <guid>http://test.mylass.com/linux/linux-auto-start/</guid>
      <description>
        
          
            &lt;p&gt;本文介绍linux服务的开户自动启动方式，分两两种，以下&lt;/p&gt;
          
          
        
      </description>
    </item>
    
  </channel>
</rss>
