<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="//www.w3.org/2005/Atom">
  <channel>
    <title>LY</title>
    <description>my blog</description>
    <link>https://liuyan5258.github.io/</link>
    <atom:link href="https://liuyan5258.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 09 Jan 2019 09:32:55 +0000</pubDate>
    <lastBuildDate>Wed, 09 Jan 2019 09:32:55 +0000</lastBuildDate>
    <generator>Jekyll v3.7.4</generator>
    
      <item>
        <title>全栈开发之服务器登录和配置</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#远程登录服务器&quot; id=&quot;markdown-toc-远程登录服务器&quot;&gt;远程登录服务器&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

在阿里云服务器上购买主机，选择适合自己的套餐，配置服务器时建议选择Ubuntu14.04.4系统。当然你也可以用公司的测试服务器，然后自己买个域名，绑定到公司服务器的ip地址。如果你只是想玩玩，也可以不用买域名。

&lt;h3 id=&quot;远程登录服务器&quot;&gt;远程登录服务器&lt;/h3&gt;

购买完主机，首先我们就有了一个服务器的ip地址。登录远程服务器，我们还需要一个用户名，每个云服务商默认的用户名可能不一样，阿里云默认的用户名是root，默认端口是22.

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ssh root@10.173.32.13
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;然后会提示你输入密码，这里需要输入的密码是你前面购买阿里云服务器时在网页上所填写的后台的登录密码，填的时候要用记得在某个地方纪录下来，这个忘记了就很麻烦了。也可以通过私钥认证的方式进行无密码登录。这个后面会说到。&lt;/li&gt;
&lt;/ul&gt;

如果你在购买服务器的时候，多买了一个数据盘，那这个数据盘就需要额外来挂载，如果你没有购买的话，当然是不需要挂载的，因为默认的阿里云就已经给你挂载了一个硬盘，应该是20G的，这个硬盘是用来安装操作系统的。如果你把网站应用都跑在这个系统盘上也不是不可以，但是一旦重装系统之后，所有的网站数据，比如用户资料都会丢失。如果你把网站应用挂在了数据盘的话，就能提高一个安全性，即使你重装了系统，数据盘的文件还在那儿。

</description>
        <pubDate>Thu, 11 Jan 2018 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2018/01/11/nodejs-deploy/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2018/01/11/nodejs-deploy/</guid>
        
        <category>Nodejs</category>
        
        
        <category>Nodejs实战</category>
        
        <category>服务器</category>
        
      </item>
    
      <item>
        <title>git的使用——修改commit历史纪录</title>
        <description>
&lt;blockquote&gt;
  主要针对项目版本控制器Git的使用中遇到的有关提交历史纪录的问题，进行实践总结。在项目开发中经常会需要修改提交commit信息，合并多个提交commit，甚至放弃当前修改回退至某一历史提交的需求，那我们到底该如何操作呢？
&lt;/blockquote&gt;

</description>
        <pubDate>Fri, 15 Dec 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/12/15/git/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/12/15/git/</guid>
        
        <category>git</category>
        
        <category>tools</category>
        
        
        <category>tools</category>
        
      </item>
    
      <item>
        <title>远程服务器使用mongodb3.4遇到的一些问题</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#在ubuntu环境下配置mongodb的服务&quot; id=&quot;markdown-toc-在ubuntu环境下配置mongodb的服务&quot;&gt;在Ubuntu环境下配置mongodb的服务&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;在ubuntu环境下配置mongodb的服务&quot;&gt;在Ubuntu环境下配置mongodb的服务&lt;/h3&gt;

远程服务器的环境是Ubuntu的，要在生产环境下运行mongodb。
首先，按照官方文档安装mongodb，安装完之后来配置。

&lt;blockquote&gt;
  sudo vi /etc/mongod.conf
&lt;/blockquote&gt;

&lt;div class=&quot;language-shell highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;# where to write logging data.&lt;/span&gt;
systemLog:
  destination: file
  logAppend: &lt;span class=&quot;nb&quot;&gt;true
  &lt;/span&gt;path: /var/log/mongodb/mongod.log

&lt;span class=&quot;c&quot;&gt;# network interfaces&lt;/span&gt;
net:
  port: 27017
  bindIp: 127.0.0.1
security:
  authorization: enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

</description>
        <pubDate>Wed, 01 Nov 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/11/01/linux-line/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/11/01/linux-line/</guid>
        
        <category>tools</category>
        
        
        <category>tools</category>
        
      </item>
    
      <item>
        <title>http中有趣的referer</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是referer头&quot; id=&quot;markdown-toc-什么是referer头&quot;&gt;什么是referer头&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;什么是referer头&quot;&gt;什么是referer头&lt;/h3&gt;

&lt;blockquote&gt;
  referer请求头让服务器能够拿到请求资源的来源。比如我在www.weibo.com里面点击一个www.baidu.com的链接，那么在www.baidu.com的页面的header信息里就会有Referer=www.weibo.com。&lt;br /&gt;
  referer可以用于分析用户的兴趣爱好、收集日志、优化缓存等等。也可以让服务器发现过时的和错误的链接并及时维护。
&lt;/blockquote&gt;

referer有很多合法的用例，例如找到你网站上的死链、追踪错误或找到用户是通过哪些搜索条件找到你的网站的。

可以用来提高网站的安全性，检查referer头是一个阻止跨站请求伪造的办法。

</description>
        <pubDate>Tue, 15 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/08/15/http-referrer/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/08/15/http-referrer/</guid>
        
        <category>Http</category>
        
        <category>前端安全性</category>
        
        
        <category>Http</category>
        
      </item>
    
      <item>
        <title>前端工程师面试题解答一</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#说一说你了解的css盒模型&quot; id=&quot;markdown-toc-说一说你了解的css盒模型&quot;&gt;说一说你了解的css盒模型&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#box-sizing的应用场景&quot; id=&quot;markdown-toc-box-sizing的应用场景&quot;&gt;box-sizing的应用场景&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#flex弹性布局&quot; id=&quot;markdown-toc-flex弹性布局&quot;&gt;flex弹性布局&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#未知宽高元素如何上下左右垂直居中&quot; id=&quot;markdown-toc-未知宽高元素如何上下左右垂直居中&quot;&gt;未知宽高元素如何上下左右垂直居中&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#css预处理器&quot; id=&quot;markdown-toc-css预处理器&quot;&gt;css预处理器&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

面试的时候主要看简历发挥，所以简历不能写得太浮夸，要不然面试官问到你都答不上来。

&lt;h3 id=&quot;说一说你了解的css盒模型&quot;&gt;说一说你了解的css盒模型&lt;/h3&gt;

我了解的css的盒模型有两种：标准浏览器的盒模型和IE的怪异盒模型

大多数浏览器采用的是W3C标准模型，而IE中采用的是Microsoft自己的标准。

怪异模式是“部分浏览器在支持W3C标准的同时还保留了原来的解析模式”，怪异模式的内核主要表现在IE内核的浏览器中。

&lt;blockquote&gt;
  对HTML文件来说，浏览器使用文件开头的 DOCTYPE 来决定用怪异模式处理或标准模式处理。为了确保你的页面使用标准模式，请确认你的页面如同本范例一样拥有 DOCTYPE：&lt;code class=&quot;highlighter-rouge&quot;&gt;&lt;span class=&quot;cp&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;/code&gt;
&lt;/blockquote&gt;

当不对doctype进行定义时，会触发怪异模式。

在标准模式下，一个块的总宽度 = width + margin(左右) + padding(左右) + border(左右)

在怪异模式下，一个块的总宽度 = width + margin(左右)（即width已经包含了padding和border值）

&lt;blockquote&gt;
  可以通过css3的box-sizing属性控制两种盒模型的变换。
&lt;/blockquote&gt;

当设置box-sizing: border-box时，将采用怪异模式解析计算。

所以在reset初始化样式中，建议使用&lt;code class=&quot;highlighter-rouge&quot;&gt;box-sizing: border-box&lt;/code&gt;。

这样，如果我们想要一个宽度为200px的盒子，那么我们直接设置宽度为200px，这样看起来就清晰多了。当我们再设置它的左右边框和左右填充后，它的内容会自动调整。这样就更直接和一目了然了不是吗。

&lt;hr /&gt;

&lt;h3 id=&quot;box-sizing的应用场景&quot;&gt;box-sizing的应用场景&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;特殊场景的布局&lt;/li&gt;
&lt;/ol&gt;

假设我们有这样的一个场景，设置子类元素的margin或者border时，可能会撑破父层元素的尺寸，这时我就需要使用box-sizing: border-box来将border包含进元素的尺寸中，这样就不会存在撑破父层元素的情况了。

&lt;ol&gt;
  &lt;li&gt;统一风格的表单元素&lt;/li&gt;
&lt;/ol&gt;

表单中有一些input元素其实还是展现的是传统IE盒模型，带有一些默认的样式，而且在不同平台或者浏览器下的表现不一，造成了表单展现的差异。此时我们可以通过box-sizing属性来构建一个风格统一的表单元素。

&lt;hr /&gt;

&lt;h3 id=&quot;flex弹性布局&quot;&gt;flex弹性布局&lt;/h3&gt;

&lt;h3 id=&quot;未知宽高元素如何上下左右垂直居中&quot;&gt;未知宽高元素如何上下左右垂直居中&lt;/h3&gt;

&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;vertical&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;container&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nl&quot;&gt;display&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;flex&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;align&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;nx&quot;&gt;justify&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;center&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;css预处理器&quot;&gt;css预处理器&lt;/h3&gt;

</description>
        <pubDate>Mon, 14 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/08/14/base/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/08/14/base/</guid>
        
        <category>面试</category>
        
        
        <category>面试</category>
        
      </item>
    
      <item>
        <title>前端工程师面试题解答二</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#在制作一个网页应用或网站的过程中你是如何考虑其-ui安全性高性能seo可维护性以及技术因素的&quot; id=&quot;markdown-toc-在制作一个网页应用或网站的过程中你是如何考虑其-ui安全性高性能seo可维护性以及技术因素的&quot;&gt;在制作一个网页应用或网站的过程中，你是如何考虑其 UI、安全性、高性能、SEO、可维护性以及技术因素的&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;在制作一个网页应用或网站的过程中你是如何考虑其-ui安全性高性能seo可维护性以及技术因素的&quot;&gt;在制作一个网页应用或网站的过程中，你是如何考虑其 UI、安全性、高性能、SEO、可维护性以及技术因素的&lt;/h3&gt;

UI:

ui的话，那要看是什么类型的页面了，比如说移动端的活动页，要炫酷、要有个性，当然也要符合它的主题。像普通的文章浏览页面，要美观、整洁。那像后台管理系统这种，就需要简单大方了。当然，不管是移动端还是pc端，我觉得最重要的还是用户体验了，对ui的选择和放置的位置要符合大部分用户的使用习惯。你不能因为你自己是左撇子，就把登录框的登陆按钮放左边吧，那不合适啊。

</description>
        <pubDate>Mon, 14 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/08/14/base-2/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/08/14/base-2/</guid>
        
        <category>面试</category>
        
        
        <category>面试</category>
        
      </item>
    
      <item>
        <title>浏览器v8引擎</title>
        <description>
V8是一个全新的javascript引擎，它在设计之初就以高效的执行javascript大型应用为目的。在一些性能测试中，它比IE的JScript、firefox的SpiderMonkey以及Safari的JavascriptCore要快上数倍。

如果你的web程序的瓶颈在于javascript的运行效率，那么用v8代替你现在的javascript引擎很可能提升你的程序的运行效率。

v8带来的性能提升主要表现在三个部分：

&lt;blockquote&gt;
  快速属性访问&lt;br /&gt;
  动态机器码生成&lt;br /&gt;
  高效的垃圾收集
&lt;/blockquote&gt;

</description>
        <pubDate>Fri, 11 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/08/11/v8/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/08/11/v8/</guid>
        
        <category>V8</category>
        
        
        <category>V8</category>
        
      </item>
    
      <item>
        <title>前端工程化思想</title>
        <description>
&lt;blockquote&gt;
  前端工程化是一个高程次的思想，可以理解为模块化和组件化是工程化的表现形式。
&lt;/blockquote&gt;

另一种解释，更详细的工程化前端系统：

&lt;blockquote&gt;
  技术业务相关：&lt;br /&gt;
    1. 开发规范&lt;br /&gt;
    2. 模块化开发&lt;br /&gt;
    3. 组件化开发&lt;br /&gt;
  技术沉淀及共享需求：&lt;br /&gt;
    4. 组件仓库&lt;br /&gt;
  工程优化需求：&lt;br /&gt;
    5. 性能优化&lt;br /&gt;
    6. 项目部署&lt;br /&gt;
    7. 开发流程&lt;br /&gt;
    8. 开发工具
&lt;/blockquote&gt;

&lt;blockquote&gt;
  大部分我们谈“工程化”，其实只是“工具化”
&lt;/blockquote&gt;

</description>
        <pubDate>Thu, 03 Aug 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/08/03/project-think/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/08/03/project-think/</guid>
        
        <category>概念</category>
        
        <category>面试</category>
        
        
        <category>抽象</category>
        
      </item>
    
      <item>
        <title>为什么要使用https代替http</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#什么是https&quot; id=&quot;markdown-toc-什么是https&quot;&gt;什么是https&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;什么是https&quot;&gt;什么是https&lt;/h3&gt;

&lt;blockquote&gt;
  简单地讲， HTTPS 是加过密的 HTTP。这样，由于网路上传输的数据是加密的，在浏览网页时，除了你自己可以看到你在看什么网页，第三方是无法得知你在干什么的。
&lt;/blockquote&gt;

</description>
        <pubDate>Mon, 31 Jul 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/07/31/why-use-https/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/07/31/why-use-https/</guid>
        
        <category>Https</category>
        
        <category>安全性</category>
        
        
        <category>安全性</category>
        
      </item>
    
      <item>
        <title>为gitPage静态网站添加service worker离线访问功能</title>
        <description>&lt;ul id=&quot;markdown-toc&quot;&gt;
  &lt;li&gt;&lt;a href=&quot;#先决条件&quot; id=&quot;markdown-toc-先决条件&quot;&gt;先决条件：&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&quot;先决条件&quot;&gt;先决条件：&lt;/h3&gt;

1.浏览器支持

&lt;a href=&quot;https://jakearchibald.github.io/isserviceworkerready/&quot;&gt;支持的浏览器&lt;/a&gt;

2.https协议

在开发过程中，可以通过 localhost 使用服务工作线程，但如果要在网站上部署服务工作线程，需要在服务器上设置 HTTPS。注意，本地修改hosts，自定义域名映射到localhost的不生效。

</description>
        <pubDate>Mon, 31 Jul 2017 00:00:00 +0000</pubDate>
        <link>https://liuyan5258.github.io/2017/07/31/service-worker/</link>
        <guid isPermaLink="true">https://liuyan5258.github.io/2017/07/31/service-worker/</guid>
        
        <category>Html5</category>
        
        <category>Javascript</category>
        
        
        <category>Html5</category>
        
      </item>
    
  </channel>
</rss>
