Elasticsearch是一个 实时的 分布式搜索和分析引擎。
ElasticSearch基于Lucene的搜索服务器, 它提供了一个分布式多用户能力的全文搜索引擎,基于RESTful web接口。
Nginx-使用Expires缓存静态文件
Nginx-使用Expires缓存静态文件
The ngx_http_headers_module module allows adding the “Expires” and “Cache-Control” header fields, and arbitrary fields, to a response header.
|
|
缓存静态文件
可以用以下的时间单位:
ms: 毫秒
s: 秒
m: 分钟
h: 小时
d: 天
w: 星期
M: 月 (30 天)
y: 年 (365 天)
Example Configuration
|
|
The max parameter sets “Expires” to the value “Thu, 31 Dec 2037 23:55:55 GMT”, and “Cache-Control” to 10 years.
|
|
修改实例
使用360奇云测给网站打分,看到如下提示:
|
|
查看请求favicon.ico文件的响应头:
使用 curl -I 命令只查看请求的响应头:
|
|
修改Nginx配置文件,然后重启服务:
在Nginx配置文件中增加以下配置,设置静态文件的缓存时间:
|
|
重新查看请求favicon.ico文件的响应头:
|
|
可以看到,返回结果中已经存在了 Expires、Cache-Control,说明我们配置成功。
重新使用360奇云测给网站打分, 可以看到就不会再有这个警告了。
Reference
http://nginx.org/en/docs/http/ngx_http_headers_module.html
https://github.com/h5bp/server-configs-nginx
http://www.cnblogs.com/lpfuture/p/5798811.html
[END]
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick Start
Create a new post
|
|
More info: Writing
Run server
|
|
More info: Server
Generate static files
|
|
More info: Generating
Deploy to remote sites
|
|
More info: Deployment
Hexo-Sitemap
hexo-generator-sitemap
Github: https://github.com/hexojs/hexo-generator-sitemap
Generate sitemap.
Install
|
|
Example:
|
|
Options
You can configure this plugin in _config.yml.
|
|
path - Sitemap path. (Default: sitemap.xml)
template - Custom template path. This file will be used to generate sitemap.xml (See default template)
Excluding Posts
Add sitemap: false to the post’s front matter.
参考链接:
Hexo-快速入门指南
什么是 Hexo?
Hexo 是一个快速、简洁且高效的博客框架。Hexo 使用 Markdown(或其他渲染引擎)解析文章,在几秒内,即可利用靓丽的主题生成静态网页。
Hexo出自台湾大学生 tommy351 之手,是一个基于 Node.js 的静态博客程序.
安装前提
安装 Hexo 相当简单。然而在安装前,您必须检查电脑中是否已安装下列应用程序:
Node.js
Git
如果您的电脑中已经安装上述必备程序,那么恭喜您!接下来只需要使用 npm 即可完成 Hexo 的安装。
$ npm install -g hexo-cli
$ hexo clean
$ hexo generate
$ hex server
重启hexo server:
由于Nodejs服务器不支持热更新,需要使用 Ctrl+C 关闭服务器,再重启:
|
|
Git deployer plugin for Hexo.
Installation
|
|
Options
You can configure this plugin in _config.yml.
|
|
[END]
Hexo-如何增加导航栏(Menu)
本文要讲述如何如何增加导航栏(Menu)。
IT开发常用网址导航
资讯
伯乐在线: http://blog.jobbole.com/
社区
开源中国社区: http://www.oschina.net/
cnodejs: http://cnodejs.org/
前端开发
nodejs: https://nodejs.org/en/
MDN https://developer.mozilla.org/en-US/docs/Web
MDN-Http https://developer.mozilla.org/en-US/docs/Web/HTTP
MDN-JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript
后端开发
Laravel文档: https://laravel.com/docs
CodeIgniter文档: https://www.codeigniter.com/user_guide/index.html#
CodeIgniter文档(中文): https://codeigniter.org.cn/
工具
菜鸟教程 http://www.runoob.com/
易百教程 http://www.yiibai.com/
w3school http://www.w3school.com.cn/
OSChina 在线工具: http://tool.oschina.net/
PHP Laravel-Homestead开发环境安装与配置
PHP Laravel-Homestead 开发环境安装与配置
Laravel Homestead 是一个官方预载的 Vagrant「封装包」,提供你一个美好的开发环境,不需要在本机端安装 PHP、HHVM、网页服务器或任何服务器软件。
Homestead 可以在任何 Windows、Mac 或 Linux 上面运行,里面包含了 Nginx 网页服务器、PHP 5.6、MySQL、Postgres、Redis、Memcached等软件,
还有所有你要开发精彩的 Laravel 应用程序所需的软件。
本机系统环境:
|
|
不使用用Homestead,直接在本机安装:
使用homebrew安装PHP7:
$ brew update
$ brew search php70
homebrew/php/php70
homebrew/php/php70-gmagick
homebrew/php/php70-maxminddb
homebrew/php/php70-pdo-pgsql
homebrew/php/php70-stats
homebrew/php/php70-amqp
…
$ brew install homebrew/php/php70
配置php-fpm端口为9002, 因为本机已经安装了php5, 占用了9001端口。
配置Nginx配置文件:
重启Nginx服务器。
安装Homestead Vagrant Box:
下载 Homestead:
|
|
下载 Homestead Vagrant Box:
$ vagrant box add laravel/homestead
执行示例:
|
|
启动虚拟机
|
|
打开VirtualBox中,可以看到有一个名为”homestead-7”的虚拟机正在运行(状态为:Running)。
配置Hosts文件:
|
|
Make sure the IP address listed is the one set in your ~/.homestead/Homestead.yaml file.
使用laravel创建一个站点:
$ cd ~/Code
$ composer require laravel/homestead –dev
配置文件“Homestead.yaml”里包含一个示例站点配置.
注意默认的站点是”/home/vagrant/Code/Laravel/public”,
所以我们现在创建在~/Code下面创建一个名为”Laravel”。
$ laravel new Laravel
-bash: laravel: command not found
$ ~/.composer/vendor/bin/laravel new Laravel
/home/vagrant/Code/Laravel/public
打开浏览器,输入”http://homestead.app/“, 即可正常访问。
配置 Homestead
配置文件路径是: ~/.homestead/Homestead.yaml
配置文件内容如下:
配置示例: 新增一个网站”kaixin123.app”:
(1) 新增网站目录”kaixin123net”:
在Code目录中新增一个kaixin123net目录,作为新增网站的根目录:
创建一个index.html文件,随便写写内容,比如”hello,kaixin123.app”:
路径如下: ~/Code/kaixin123net/index.html
(2) 增加sites:
(3) 新增一条host记录:
(4) 打开浏览器,输入”http://kaixin123.app/“, 可以正常访问。
如果重新修改配置,需要重新加载vagrant:
|
|
登录虚拟机:
$ cd ~/Homestead/
$ vagrant ssh
|
|
连接Homestead数据库:
>
To connect to your MySQL or Postgres database from your host machine via Navicat or Sequel Pro:
Connect to 127.0.0.1 and port 33060 (MySQL) or 54320 (Postgres).
The username and password for both databases is homestead / secret.
地址: 192.168.10.10
端口: 3306
用户名: homestead
密码: secret
登录虚拟机数据库:
|
|
以后再次启动/登录:
$ cd ~/Homestead/
$ vagrant up
$ vagrant ssh
扩展阅读
(1) brew
brew(即Homebrew), 是macOS上的软件包管理工具, 能在Mac中方便的安装软件或者卸载软件,类似ubuntu系统下的apt-get的功能.
Homebrew- The missing package manager for OS X
http://brew.sh/
(2) Vagrant
Vagrant是一个基于Ruby的工具,用于创建和部署虚拟化开发环境。它使用Oracle的开源VirtualBox虚拟化系统,使用Chef创建自动化虚拟环境。
https://www.vagrantup.com/
(3) Laravel
Laravel是一套简洁、优雅的PHP Web开发框架(PHP Web Framework)。
https://laravel.com/
参考资料
https://laravel.com/docs/5.3/homestead
http://laravelacademy.org/post/2749.html
http://laravel-china.org/docs/5.1/homestead
https://www.vagrantup.com/docs/getting-started/
更新记录
- 20160825 新增此文档 (wangyt)
- 20160829 更新文档,改成Homestead安装与配置 (wangyt)
- 20160922 更新文档,新增配置多站点 (wangyt)
Git 快速入门指导
Git的基本使用教程
Git简介
Git是一个分布式的版本控制系统(DVCS, Distributed Version Control Systems).
Git官网: https://git-scm.com/
Git下载: https://git-scm.com/download/