## [點擊查看淘寶翻譯的 Nginx 中文文檔](http://tengine.taobao.org/nginx_docs/cn/docs/)
>[info] 全局配置
設置用戶以及用戶組
~~~
user www www;
~~~
設置工作進程數量
~~~
worker_processes auto;
~~~
worker 進程最大打開文件數
~~~
worker_rlimit_nofile 51200;
~~~
>[info] events 模塊
單個 worker 進程最大允許連接數量
~~~
worker_connections 1024;
~~~
說明:內存越大,可設置的值越大
一個 worker 進程可以接受多個網絡請求
~~~
multi_accept on;
~~~
>[info] http 模塊
開啟 gzip 壓縮模式
~~~
gzip on;
~~~
>[info] http 模塊下的 server 模塊
監聽80端口
~~~
listen 80;
~~~
監聽域名為 sixstar.test 的請求
~~~
server_name sixstar.test;
~~~
默認訪問 index.php 文件
~~~
index index.php;
~~~
訪問的根路徑是 /sixstar(此處填寫的路徑應對應系統磁盤)
~~~
root /sixstar;
~~~
定義 test 路由訪問的程序
~~~
location /test {
default_type text/html;
return 200 'Hello World!';
}
~~~
說明:訪問 ‘你定義的域名/test‘ 返回 ‘Hello World!‘
訪問 /sixstar/data/test/ 路徑下的 index.html
~~~
location /test {
alias /sixstar/data;
}
~~~
Nginx 限制IP訪問頻率l
~~~
limit_req_zone $binary_remote_addr zone=allips:10m rate=5r/s;
limit_req zone=allips;
~~~
說明:limit_req_zone 需要在http 模塊添加,limit_req 需要在 location 模塊中添加
參考文章:[https://www.w3cschool.cn/nginxsysc/nginxsysc-limit-req.html](https://www.w3cschool.cn/nginxsysc/nginxsysc-limit-req.html)
- MySQL
- MySQL 開啟遠程訪問權限
- MySQL 查詢語句
- Explain 分析器
- MySQL 索引
- MySQL 主從復制
- Binlog 日志
- Docker
- Docker 安裝
- Docker 常用命令
- Docker 網絡
- Docker 安裝MySQL
- Redis
- Redis 常用命令
- Redis 配置文件
- Redis 主從復制
- Nginx
- Nginx 常用命令
- Nginx 內置變量
- Nginx 配置文件
- Nginx 負載均衡
- Composer
- Composer 構架組件
- Swoole
- Laravel
- 正則表達式
- Linux
- Linux 常用命令
- Linux 系統相關命令
- Git
- Git 全局配置
- Git 版本控制
- Git 遠程倉庫
- Git 分支管理
- Git 忽略文件
- Supervisor
- Supervisor 安裝
- Supervisor 配置文件
- Supervisor 常用命令