2019年4月


nginx rewrite 模块主要应用于修改客户端发起的 url 请求,主要使用场景有两个:
1.客户端请求的域名已经已经有了新的地址,需要自动将连接进行转换
2.需要根据请求的 url 动态处理到不同的页面,此处主要使用 try_files 指令

阅读全文


常用状态码:

200 OK                        //客户端请求成功
301 Moved Permanently         //重定向到新的 URL
400 Bad Request               //客户端请求有语法错误,不能被服务器所理解
401 Unauthorized              //请求未经授权,这个状态代码必须和WWW-Authenticate报头域一起使用 
403 Forbidden                 //服务器收到请求,但是拒绝提供服务
404 Not Found                 //请求资源不存在,eg:输入了错误的URL
500 Internal Server Error     //服务器发生不可预期的错误
503 Server Unavailable        //服务器当前不能处理客户端的请求,一段时间后可能恢复正常

此文摘抄自:https://www.w3.org/Protocols/rfc2616/rfc2616.html

10 Status Code Definitions

Each Status-Code is described below, including a description of which method(s) it can follow and any metainformation required in the response.

阅读全文


本文主要参考的网站:
https://cipherli.st
https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html

This tutorial shows you how to set up strong SSL security on the nginx webserver. We do this by updating OpenSSL to the latest version to mitigate attacks like Heartbleed, disabling SSL Compression and EXPORT ciphers to mitigate attacks like FREAK, CRIME and LogJAM, disabling SSLv3 and below because of vulnerabilities in the protocol and we will set up a strong ciphersuite that enables Forward Secrecy when possible. We also enable HSTS and HPKP. This way we have a strong and future proof ssl configuration and we get an A+ on the Qually Labs SSL Test.

阅读全文


这里使用的是 Nginx 做代理。

使用 http2 需要 openssl 的版本至少是 1.0.2。使用命令openssl version查看当前版本,如果太低,需要先升级 openssl。

升级教程:https://niekun.net/index.php/archives/30.html

在 Nginx 配置文件的 server 段内修改如下:

server {
    listen               443 ssl http2;
    listen               [::]:443 ssl http2;
    ...
}

实际就是在原有配置基础上,在 listen 内加入 http2 即可。

修改后测试及重新加载配置文件:

service nginx configtest
service nginx reload