As an open-source project, dunwu/nginx-tutorial has picked up 5.5k stars on GitHub (JavaScript). 这是一个 Nginx 极简教程,目的在于帮助新手快速入门 Nginx。
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
@echo off
rem 如果启动前已经启动nginx并记录下pid文件,会kill指定进程
nginx.exe -s stop
rem 测试配置文件语法正确性
nginx.exe -t -c conf/nginx.conf
rem 显示版本信息
nginx.exe -v
rem 按照指定配置去启动nginx
nginx.exe -c conf/nginx.conf
假设这样一个应用场景:将应用部署在 192.168.1.11:80、192.168.1.12:80、192.168.1.13:80 三台 linux 环境的服务器上。网站域名叫 www.helloworld.com,公网 IP 为 192.168.1.11。在公网 IP 所在的服务器上部署 nginx,对所有请求做负载均衡处理(下面例子中使用的是加权轮询策略)。
upstream bck_testing_01 {
# 默认所有服务器权重为 1
server 192.168.250.220:8080
server 192.168.250.221:8080
server 192.168.250.222:8080
}
加权轮询
upstream bck_testing_01 {
server 192.168.250.220:8080 weight=3
server 192.168.250.221:8080 # default weight=1
server 192.168.250.222:8080 # default weight=1
}
最少连接
upstream bck_testing_01 {
least_conn;
# with default weight for all (weight=1)
server 192.168.250.220:8080
server 192.168.250.221:8080
server 192.168.250.222:8080
}
加权最少连接
upstream bck_testing_01 {
least_conn;
server 192.168.250.220:8080 weight=3
server 192.168.250.221:8080 # default weight=1
server 192.168.250.222:8080 # default weight=1
}
IP Hash
upstream bck_testing_01 {
ip_hash;
# with default weight for all (weight=1)
server 192.168.250.220:8080
server 192.168.250.221:8080
server 192.168.250.222:8080
}
普通 Hash
upstream bck_testing_01 {
hash $request_uri;
# with default weight for all (weight=1)
server 192.168.250.220:8080
server 192.168.250.221:8080
server 192.168.250.222:8080
}
# allow origin list
set $ACAO '*';
# set single origin
if ($http_origin ~* (www.helloworld.com)$) {
set $ACAO $http_origin;
}
if ($cors = "trueget") {
add_header 'Access-Control-Allow-Origin' "$http_origin";
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
}
if ($request_method = 'OPTIONS') {
set $cors "${cors}options";
}
if ($request_method = 'GET') {
set $cors "${cors}get";
}
if ($request_method = 'POST') {
set $cors "${cors}post";
}
How active is development on dunwu/nginx-tutorial?
The most recent commit recorded on dunwu/nginx-tutorial was 2.8 years ago, based on the GitHub push timestamp. The repository has 736 forks — one of the better signals of community interest.
How many stars does dunwu/nginx-tutorial have?
dunwu/nginx-tutorial has 5.5k GitHub stars — refresh the page for the live number, or check github.com/dunwu/nginx-tutorial. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What language is dunwu/nginx-tutorial written in?
dunwu/nginx-tutorial is written primarily in JavaScript. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is dunwu/nginx-tutorial associated with?
GitHub's repository topics for dunwu/nginx-tutorial: "load-balancer", "nginx", "proxy", "tutorial". TopGit's editorial category is open-source.
Where do I read more about dunwu/nginx-tutorial?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/dunwu/nginx-tutorial is the definitive source.
Read full README in the tab above.
Curious whether nginx-tutorial is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about nginx-tutorial.