Skip to content

Commit

Permalink
add auth user pass. #10. fix ipv6 connect to nacos. use nanopb instea…
Browse files Browse the repository at this point in the history
…d of protobuf-c
  • Loading branch information
zhwaaaaaa committed Jun 5, 2024
1 parent 26ab03b commit 6d8e944
Show file tree
Hide file tree
Showing 27 changed files with 4,249 additions and 934 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ if (NACOS)
list(APPEND NGX_C_FILES modules/auxiliary/ngx_auxiliary_module.c)
list(APPEND NGX_INC_DIR modules/nacos)
list(APPEND NGX_LINK_DIR /usr/local/lib)
list(APPEND NGX_LIBS protobuf protobuf-c)
list(APPEND NGX_C_FILES
modules/nacos/ngx_nacos_module.c
modules/nacos/ngx_nacos_aux.c
Expand All @@ -173,8 +172,7 @@ if (NACOS)
modules/nacos/ngx_http_nacos_config_module.c
modules/nacos/ngx_nacos_udp.c
modules/nacos/ngx_nacos_grpc.c
modules/nacos/nacos_grpc_service.pb-c.c
modules/nacos/any.pb-c.c
modules/nacos/nacos_grpc_service.pb.c
)

list(APPEND NGX_C_FILES
Expand All @@ -187,6 +185,9 @@ if (NACOS)
modules/nacos/yaij/yajl_parser.c
modules/nacos/yaij/yajl_tree.c
modules/nacos/yaij/yajl_version.c
modules/nacos/pb/pb_common.c
modules/nacos/pb/pb_decode.c
modules/nacos/pb/pb_encode.c
)
endif ()

Expand All @@ -202,7 +203,6 @@ elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
nginx/src/os/unix/ngx_darwin_init.c
nginx/src/event/modules/ngx_kqueue_module.c
nginx/src/os/unix/ngx_darwin_sendfile_chain.c)
list(APPEND NGX_INC_DIR /usr/local/Cellar/pcre/8.44/include)
else ()
endif ()

Expand Down
13 changes: 0 additions & 13 deletions LICENSE.isc

This file was deleted.

18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ cd nginx-1.15.2 && patch -p1 < ../nginx-nacos-upstream/patch/nginx.patch
ubuntu 下安装方式为

```bash
sudo apt install libprotobuf-dev libprotobuf-c-dev
sudo apt install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev
```

Expand Down Expand Up @@ -114,6 +113,18 @@ nginx 监听的 udp ip 和端口。原则上和 上边的 ip+port 一致。如
udp_bind 0.0.0.0:19999;
```
#### username (服务端没开启 auth 不需要)
nacos 开启 auth 之后的 username. nacos.core.auth.server.identity.key=xxxx
```
username "xxxx";
```
#### password (服务端没开启 auth 不需要)
nacos 开启 auth 之后的 password. nacos.core.auth.server.identity.value=xxxx
```
password "xxxx";
```
#### error_log
nacos 日志文件 和 级别.
```
Expand Down Expand Up @@ -210,8 +221,9 @@ nacos 变量功能让 nginx 的灵活性大大增强了。
* 支持集成 openresty
# License
- Licensed under the Apache License, Version 2.0 Copyright (c) 2023-2024, Zhwaaaaaa
- module/nacos/yaij Licensed under the ISC License, Copyright (c) 2007-2014, Lloyd Hilaiel
- The project is licensed under the Apache License Version 2.0 except for yaij and pb, Copyright (c) 2022-2024, Zhwaaaaaa
- code in module/nacos/yaij is from [yajl](https://github.com/lloyd/yajl) Licensed under the ISC License, Copyright (c) 2007-2014, Lloyd Hilaiel
- code in modules/nacos/pb is from [nanopb](https://github.com/nanopb/nanopb) Licensed under the Zlib License, Copyright (c) 2011 Petteri Aimonen <jpa at nanopb.mail.kapsi.fi>
# 致谢
感谢 [JetBrains](https://www.jetbrains.com.cn) 公司赠送激活码,作者使用 [JetBrains Clion](https://www.jetbrains.com.cn/clion) 开发本项目过程中大大提升了开发效率。
24 changes: 13 additions & 11 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

rm -rf nginx
rm -rf cmake-build-debug
rm -rf objs

curl -sSL https://nginx.org/download/nginx-1.20.2.tar.gz -o nginx.tar.gz

Expand All @@ -19,17 +19,19 @@ patch -p1 < ../patch/nginx.patch
--add-module=../modules/nacos \
--prefix=.. \
--conf-path=conf/my.conf \
--error-log-path=cmake-build-debug/logs/error.log \
--pid-path=cmake-build-debug/logs/nginx.pid \
--lock-path=cmake-build-debug/logs/nginx.lock \
--http-log-path=cmake-build-debug/logs/access.log \
--http-client-body-temp-path=cmake-build-debug/client_body_temp \
--http-proxy-temp-path=cmake-build-debug/proxy_temp \
--http-fastcgi-temp-path=cmake-build-debug/fastcgi_temp \
--http-uwsgi-temp-path=cmake-build-debug/uwsgi_temp \
--http-scgi-temp-path=cmake-build-debug/scgi_temp
--error-log-path=objs/logs/error.log \
--pid-path=objs/logs/nginx.pid \
--lock-path=objs/logs/nginx.lock \
--http-log-path=objs/logs/access.log \
--http-client-body-temp-path=objs/client_body_temp \
--http-proxy-temp-path=objs/proxy_temp \
--http-fastcgi-temp-path=objs/fastcgi_temp \
--http-uwsgi-temp-path=objs/uwsgi_temp \
--http-scgi-temp-path=objs/scgi_temp \
--with-pcre=/opt/homebrew/Cellar/pcre \
--with-openssl=/opt/homebrew/Cellar/openssl\@3

cd ..

mkdir -p cmake-build-debug
mkdir -p objs/logs
rm -f nginx.tar.gz
4 changes: 3 additions & 1 deletion conf/my.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#user nobody;
master_process on;
master_process off;
daemon off;

#error_log logs/error.log;
Expand All @@ -19,6 +19,8 @@ nacos {
#udp_port 19999; #udp 端口号
#udp_ip 127.0.0.1; #udp ip 地址。
#udp_bind 0.0.0.0:19999; # 绑定udp 地址
username "nacos";
password "nacos";
error_log cmake-build-debug/logs/nacos.log info;
default_group DEFAULT_GROUP; # 默认的nacos group name
cache_dir cmake-build-debug/nacos/;
Expand Down
105 changes: 0 additions & 105 deletions modules/nacos/any.pb-c.c

This file was deleted.

Loading

0 comments on commit 6d8e944

Please sign in to comment.