Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
_book
4 changes: 2 additions & 2 deletions How-To/WebSocket代理.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WebSocket 代理

要将客户端与服务器之间的连接从 HTTP/1.1 转换为 WebSocket,可是使用 HTTP/1.1 中的[协议切换](https://tools.ietf.org/html/rfc2616#section-14.42)机制。
要将客户端与服务器之间的连接从 HTTP/1.1 转换为 WebSocket,可是使用 HTTP/1.1 中的 [协议切换](https://tools.ietf.org/html/rfc2616#section-14.42) 机制。

然而,有一个微妙的地方:由于 `Upgrade` 是一个[逐跳](https://tools.ietf.org/html/rfc2616#section-13.5.1)(hop-by-hop)头,它不会从客户端传递到代理服务器。当使用转发代理时,客户端可以使用 `CONNECT` 方法来规避此问题。然而,这不适用于反向代理,因为客户端不知道任何代理服务器,这需要在代理服务器上进行特殊处理。

Expand Down Expand Up @@ -42,4 +42,4 @@ http {

## 原文档

[http://nginx.org/en/docs/http/websocket.html](http://nginx.org/en/docs/http/websocket.html)
[http://nginx.org/en/docs/http/websocket.html](http://nginx.org/en/docs/http/websocket.html)
20 changes: 10 additions & 10 deletions How-To/从源码构建nginx.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 从源码构建 nginx

构建使用 `configure` 命令进行配置。它定义了系统的各个方面,包括了 nginx 进行连接处理使用的方法。最终它创建出一个 `Makefile`。`configure` 命令支持以下参数:
编译时使用 `configure` 命令进行配置。它定义了系统的各个方面,包括了 nginx 进行连接处理使用的方法。最终它会创建出一个 `Makefile`。`configure` 命令支持以下参数:

- **--prefix=path**

Expand Down Expand Up @@ -63,20 +63,20 @@

设置链接期间使用的其他参数。在 FreeBSD 下使用系统 PCRE 库时,应指定--with-ld-opt="-L /usr/local/lib"`。

参数使用示例(所有这些参数都要输入在同一行上)
参数使用示例:

```bash
./configure
--sbin-path=/usr/local/nginx/nginx
--conf-path=/usr/local/nginx/nginx.conf
--pid-path=/usr/local/nginx/nginx.pid
--with-http_ssl_module
--with-pcre=../pcre-8.40
./configure \
--sbin-path=/usr/local/nginx/nginx \
--conf-path=/usr/local/nginx/nginx.conf \
--pid-path=/usr/local/nginx/nginx.pid \
--with-http_ssl_module \
--with-pcre=../pcre-8.40 \
--with-zlib=../zlib-1.2.11
```

配置完成之后,使用 `make` 编译和安装 nginx。
配置完成之后,使用 `make` 和 `make install` 编译和安装 nginx。

## 原文档

[http://nginx.org/en/docs/configure.html](http://nginx.org/en/docs/configure.html)
[http://nginx.org/en/docs/configure.html](http://nginx.org/en/docs/configure.html)
4 changes: 2 additions & 2 deletions How-To/使用DTrace_pid提供程序调试nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef ngx_http_request_body_t void;

最后但同样重要的是,需要添加两个成员结构的定义(`ngx_http_headers_in_t`,`ngx_http_headers_out_t`)、回调函数声明和常量定义。

最后,DTrace 脚本可以从[这里](http://nginx.org/download/trace_process_request.d)下载。
最后,DTrace 脚本可以从 [这里](http://nginx.org/download/trace_process_request.d) 下载。

以下示例是运行此脚本的输出:

Expand All @@ -70,4 +70,4 @@ request start sec = 1349162899

## 原文档

[http://nginx.org/en/docs/nginx_dtrace_pid_provider.html](http://nginx.org/en/docs/nginx_dtrace_pid_provider.html)
[http://nginx.org/en/docs/nginx_dtrace_pid_provider.html](http://nginx.org/en/docs/nginx_dtrace_pid_provider.html)
4 changes: 2 additions & 2 deletions How-To/在Win32平台上使用VisualC构建nginx.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

## 构建步骤

在开始构建之前,确保将 Perl、Mercurial 和 MSYS 的 bin 目录路径添加到 PATH 环境变量中。从 Visual C 目录运行vcvarsall.bat 脚本设置 Visual C 环境。
在开始构建之前,确保将 Perl、Mercurial 和 MSYS 的 bin 目录路径添加到 PATH 环境变量中。从 Visual C 目录运行 vcvarsall.bat 脚本设置 Visual C 环境。

构建 nginx:

Expand Down Expand Up @@ -60,4 +60,4 @@ nmake -f objs/Makefile

## 原文档

[http://nginx.org/en/docs/howto_build_on_win32.html](http://nginx.org/en/docs/howto_build_on_win32.html)
[http://nginx.org/en/docs/howto_build_on_win32.html](http://nginx.org/en/docs/howto_build_on_win32.html)
26 changes: 14 additions & 12 deletions How-To/转换重写规则.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

使用共享主机的用户以前仅使用 Apache 的 `.htaccess` 文件来配置一切,通常翻译下列规则:

```apache
```apacheconf
RewriteCond %{HTTP_HOST} example.org
RewriteRule (.*) http://www.example.org$1
```
Expand Down Expand Up @@ -38,14 +38,15 @@ server {
}
```

> 在 0.9.1 之前的版本,重定向可以通过以下方式实现:
> ```nginx
> rewrite ^ http://www.example.org$request_uri?;
> ```
在 0.9.1 之前的版本,重定向可以通过以下方式实现:

```nginx
rewrite ^ http://www.example.org$request_uri?;
```

另一个例子是使用了颠倒逻辑,即 **所有不是 `example.com` 和 `www.example.com` 的**:

```apache
```apacheconf
RewriteCond %{HTTP_HOST} !example.com
RewriteCond %{HTTP_HOST} !www.example.com
RewriteRule (.*) http://www.example.com$1
Expand All @@ -67,16 +68,17 @@ server {
}
```

> 在 0.9.1 之前的版本,重定向可以通过以下方式实现:
> ```nginx
> rewrite ^ http://example.com$request_uri?;
> ```
在 0.9.1 之前的版本,重定向可以通过以下方式实现:

```nginx
rewrite ^ http://example.com$request_uri?;
```

## 转换 Mongrel 规则

典型的 Mongrel 规则:

```apache
```apacheconf
DocumentRoot /var/www/myapp.com/current/public

RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
Expand Down Expand Up @@ -113,4 +115,4 @@ location @mongrel {

## 原文档

[http://nginx.org/en/docs/http/converting_rewrite_rules.html](http://nginx.org/en/docs/http/converting_rewrite_rules.html)
[http://nginx.org/en/docs/http/converting_rewrite_rules.html](http://nginx.org/en/docs/http/converting_rewrite_rules.html)
133 changes: 6 additions & 127 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,14 @@
# Nginx 中文文档
![Nginx logo](http://nginx.org/nginx.png)
[![GitHub stars](https://img.shields.io/github/stars/DocsHome/nginx-docs.svg?style=social&label=Stars)](https://github.com/DocsHome/nginx-docs) [![GitHub contributors](https://img.shields.io/github/contributors/DocsHome/nginx-docs.svg)](https://github.com/DocsHome/nginx-docs) [![GitHub pull requests](https://img.shields.io/github/issues-pr/DocsHome/nginx-docs.svg)](https://github.com/DocsHome/nginx-docs) [![GitHub last commit](https://img.shields.io/github/last-commit/DocsHome/nginx-docs.svg)](https://github.com/DocsHome/nginx-docs)

Nginx 官方文档中文翻译版,由本人在学习 nginx 时顺带翻译。由于部分章节涉及到 Nginx Plus 或者其他内容,将忽略这部分章节的内容。如果您发现内容存在错误或者不当之处,欢迎指出或者 PR,同时也欢迎您的加入。
![Nginx logo](https://nginx.org/nginx.png)

## 索引
Nginx 官方文档中文翻译版,由本人在学习 nginx 时顺带翻译。由于部分章节涉及到 Nginx Plus 或者其他内容,将忽略这部分章节的内容。如果您发现内容存在错误或者不当之处,请提出 PR,期待您的加入。

### 介绍
- [安装 nginx](介绍/安装nginx.md)
- [初学者指南](介绍/初学者指南.md)
- 管理指南
- [控制 nginx](介绍/控制nginx.md)
- [连接处理方式](介绍/连接处理方式.md)
- [设置哈希](介绍/设置哈希.md)
- [调试日志](介绍/调试日志.md)
- [记录日志到 syslog](介绍/记录日志到syslog.md)
- [配置文件度量单位](介绍/配置文件度量单位.md)
- [命令行参数](介绍/命令行参数.md)
- [Windows 下的 nginx](介绍/Windows下的Nginx.md)
在线阅读:[Github](SUMMARY.md)

- [nginx 如何处理请求](介绍/Nginx如何处理请求.md)
- [服务器名称](介绍/服务器名称.md)
- [使用 nginx 作为 HTTP 负载均衡器](介绍/使用Nginx作为HTTP负载均衡器.md)
- [配置 HTTPS 服务器](介绍/配置HTTPS服务器.md)

- [nginx 如何处理 TCP/UDP 会话](介绍/Nginx如何处理TCP_UDP会话.md)

- [关于 nginScript](介绍/关于nginScript.md)

- “开源应用程序架构” 中的 “nginx” 章节

### How-To
- [从源码构建 nginx](How-To/从源码构建nginx.md)
- [在 Win32 平台上使用 Visual C 构建 nginx](How-To/在Win32平台上使用VisualC构建nginx.md)
- 设置 Amazon EC2 的 Nginx Plus 环境
- [使用 DTrace pid 提供程序调试 nginx](How-To/使用DTrace_pid提供程序调试nginx.md)

- [转换重写规则](How-To/转换重写规则.md)
- [WebSocket 代理](How-To/WebSocket代理.md)

### 开发
- [贡献变更](开发/贡献变更.md)
- 开发指南

### 模块参考
- 指令字母索引
- 变量字母索引

- [核心功能](模块参考/核心功能.md)

- [ngx_http_core_module](模块参考/http/ngx_http_core_module.md)(翻译中)
- [ngx_http_access_module](模块参考/http/ngx_http_access_module.md)
- [ngx_http_addition_module](模块参考/http/ngx_http_addition_module.md)
- [ngx_http_auth_basic_module](模块参考/http/ngx_http_auth_basic_module.md)
- [ngx_http_auth_jwt_module](模块参考/http/ngx_http_auth_jwt_module.md)
- [ngx_http_auth_request_module](模块参考/http/ngx_http_auth_request_module.md)
- [ngx_http_autoindex_module](模块参考/http/ngx_http_autoindex_module.md)
- ngx_http_browser_module
- [ngx_http_charset_module](模块参考/http/ngx_http_charset_module.md)
- ngx_http_dav_module
- ngx_http_empty_gif_module
- ngx_http_f4f_module
- ngx_http_fastcgi_module
- ngx_http_flv_module
- ngx_http_geo_module
- ngx_http_geoip_module
- ngx_http_gunzip_module
- ngx_http_gzip_module
- [ngx_http_gzip_static_module](模块参考/http/ngx_http_gzip_static_module.md)
- ngx_http_headers_module
- ngx_http_hls_module
- ngx_http_image_filter_module
- ngx_http_index_module
- ngx_http_js_module
- ngx_http_limit_conn_module
- ngx_http_limit_req_module
- ngx_http_log_module
- ngx_http_map_module
- ngx_http_memcached_module
- ngx_http_mirror_module
- ngx_http_mp4_module
- ngx_http_perl_module
- ngx_http_proxy_module
- [ngx_http_random_index_module](模块参考/http/ngx_http_random_index_module.md)
- ngx_http_realip_module
- ngx_http_referer_module
- ngx_http_rewrite_module
- ngx_http_scgi_module
- ngx_http_secure_link_module
- ngx_http_session_log_module
- ngx_http_slice_module
- ngx_http_spdy_module
- ngx_http_split_clients_module
- ngx_http_ssi_module
- ngx_http_ssl_module
- ngx_http_status_module
- ngx_http_stub_status_module
- ngx_http_sub_module
- ngx_http_upstream_module
- ngx_http_upstream_conf_module
- ngx_http_upstream_hc_module
- ngx_http_userid_module
- ngx_http_uwsgi_module
- ngx_http_v2_module
- ngx_http_xslt_module

- ngx_mail_core_module
- ngx_mail_auth_http_module
- ngx_mail_proxy_module
- ngx_mail_ssl_module
- ngx_mail_imap_module
- ngx_mail_pop3_module
- ngx_mail_smtp_module

- ngx_stream_core_module
- ngx_stream_access_module
- ngx_stream_geo_module
- ngx_stream_geoip_module
- ngx_stream_js_module
- ngx_stream_limit_conn_module
- ngx_stream_log_module
- ngx_stream_map_module
- ngx_stream_proxy_module
- ngx_stream_realip_module
- ngx_stream_return_module
- ngx_stream_split_clients_module
- ngx_stream_ssl_module
- ngx_stream_ssl_preread_module
- ngx_stream_upstream_module
- ngx_stream_upstream_hc_module

- ngx_google_perftools_module
## 排版规范
本文档排版遵循 [中文文案排版指北](https://github.com/mzlogin/chinese-copywriting-guidelines)。

## LICENSE
![知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议](https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png)
Expand Down
Loading