有点疑问,关于端口方面的
旧笔记本装了 pve pve 里装了 ubuntu 然后装了 docker
就想着搞点东西玩,现在搞了几个数据库 还有 alist
最近了解到了 bitwarden 密码管理,也想着弄个上去玩玩
但是有个问题是,这个项目端口是 80 , 于是想找了下想修改端口的方法,但是并没有找到多少是教如何改掉它 80 端口的
虽然可以设置端口映射,但是 docker 内如果有另外一个项目也是 80 端口的呢?
就很困扰
有人说用 nginx ,我没怎么用过,看了下入门视频,即使用 nginx ,它端口还是 80 呀,就好奇怪
#端口 #80 #pve #docker #nginx #但是 #想着 #里装 #ubuntu #alist
旧笔记本装了 pve pve 里装了 ubuntu 然后装了 docker
就想着搞点东西玩,现在搞了几个数据库 还有 alist
最近了解到了 bitwarden 密码管理,也想着弄个上去玩玩
但是有个问题是,这个项目端口是 80 , 于是想找了下想修改端口的方法,但是并没有找到多少是教如何改掉它 80 端口的
虽然可以设置端口映射,但是 docker 内如果有另外一个项目也是 80 端口的呢?
就很困扰
有人说用 nginx ,我没怎么用过,看了下入门视频,即使用 nginx ,它端口还是 80 呀,就好奇怪
#端口 #80 #pve #docker #nginx #但是 #想着 #里装 #ubuntu #alist
请教如何排查 nginx 未响应情况
**我是开发者,目前不知道往哪方面查,请广大 v 友提供思路**
## 问题与现状
不定期出现访问未响应情况,持续时间几分钟,期间 nginx 映射所有访问不了,并服务器也 ssh 不上,日志没出现 Too many open files 等任何报错
服务器:阿里 ecs.g7.large ,2 核 8G 内存
nginx 自己编译
``` bash
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/home/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-pcre --with-pcre-jit --with-debug
```
部署服务:很多静态文件,但不是 js 、css 这些
访问量:不太清楚怎么算
## 目前排查情况
1. 调整过 worker_connections 不起作用
2. 在未响应期间,看 cpu 指标,没有明显新增,看 tcp 连接数 ESTABLISHED 和 TIME_WAIT 也不多,因不太懂 tcp 这块,不知是不是这块问题
## nginx 核心配置 摘要
``` conf
#user nobody;
worker_processes 2;
worker_cpu_affinity auto;
pid logs/nginx.pid;
error_log /home/nginx/logs/error.log notice;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
accept_mutex on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
#access_log logs/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
keepalive_timeout 65;
send_timeout 30s;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
proxy_connect_timeout 5s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types text/css text/xml application/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6].";
include /home/nginx/conf/conf.d/*.conf;
}
```
#-- #http #nginx #module #gzip #timeout #worker #tcp #conf #log
**我是开发者,目前不知道往哪方面查,请广大 v 友提供思路**
## 问题与现状
不定期出现访问未响应情况,持续时间几分钟,期间 nginx 映射所有访问不了,并服务器也 ssh 不上,日志没出现 Too many open files 等任何报错
服务器:阿里 ecs.g7.large ,2 核 8G 内存
nginx 自己编译
``` bash
nginx version: nginx/1.22.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
built with OpenSSL 1.0.2k-fips 26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/home/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-pcre --with-pcre-jit --with-debug
```
部署服务:很多静态文件,但不是 js 、css 这些
访问量:不太清楚怎么算
## 目前排查情况
1. 调整过 worker_connections 不起作用
2. 在未响应期间,看 cpu 指标,没有明显新增,看 tcp 连接数 ESTABLISHED 和 TIME_WAIT 也不多,因不太懂 tcp 这块,不知是不是这块问题
## nginx 核心配置 摘要
``` conf
#user nobody;
worker_processes 2;
worker_cpu_affinity auto;
pid logs/nginx.pid;
error_log /home/nginx/logs/error.log notice;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
multi_accept on;
accept_mutex on;
use epoll;
}
http {
include mime.types;
default_type application/octet-stream;
charset utf-8;
#access_log logs/access.log main;
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
server_names_hash_bucket_size 128;
server_names_hash_max_size 512;
keepalive_timeout 65;
send_timeout 30s;
client_header_timeout 15;
client_body_timeout 15;
reset_timedout_connection on;
proxy_connect_timeout 5s;
proxy_send_timeout 120s;
proxy_read_timeout 120s;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 32k;
gzip_http_version 1.1;
gzip_comp_level 4;
gzip_types text/css text/xml application/javascript;
gzip_vary on;
gzip_disable "MSIE [1-6].";
include /home/nginx/conf/conf.d/*.conf;
}
```
#-- #http #nginx #module #gzip #timeout #worker #tcp #conf #log
nginx 报这个错误, connect() to unix:/run/ PHP /php7.2-fpm.sock failed (11: Resource temporarily unavailable)
```
后台系统偶尔会出现 502 ,收集 nginx 错误日志如下
nginx 报这个错误,connect() to unix:/run/php/php7.2-fpm.sock failed (11: Resource temporarily unavailable)
所以想请问这种问题如何定位。
参考这个帖子配置了 linux 相关参数,但是还是无效。所以不想请问该如何定位
https://serverfault.com/questions/843460/php-fpm-sock-failed-11-resource-temporarily-unavailable-while-connecting-to-u
```
#nginx #php #fpm #sock #failed #11 #temporarily #unavailable #请问 #定位
```
后台系统偶尔会出现 502 ,收集 nginx 错误日志如下
nginx 报这个错误,connect() to unix:/run/php/php7.2-fpm.sock failed (11: Resource temporarily unavailable)
所以想请问这种问题如何定位。
参考这个帖子配置了 linux 相关参数,但是还是无效。所以不想请问该如何定位
https://serverfault.com/questions/843460/php-fpm-sock-failed-11-resource-temporarily-unavailable-while-connecting-to-u
```
#nginx #php #fpm #sock #failed #11 #temporarily #unavailable #请问 #定位
个人网站被 Chrome 和 Safari 标记成危险网站了 不知道为什么
有人有类似经历吗
我的网站基本都放在 cloudflare 后面,除了 nginx proxy manager 放在二级子域名没法用 cf ,其他服务器面板比如 portainer cockpit 什么的都放在 cloudflare access 后面。感觉只有 nginx proxy manager 是弱点。。但我登录上去也没发现什么异常
#cloudflare #nginx #proxy #manager #放在 #没法用 #后面 #cf #portainer #cockpit
有人有类似经历吗
我的网站基本都放在 cloudflare 后面,除了 nginx proxy manager 放在二级子域名没法用 cf ,其他服务器面板比如 portainer cockpit 什么的都放在 cloudflare access 后面。感觉只有 nginx proxy manager 是弱点。。但我登录上去也没发现什么异常
#cloudflare #nginx #proxy #manager #放在 #没法用 #后面 #cf #portainer #cockpit
求助,我想反代 ipv6,但是报错了
用 cf 太慢,我想用 nginx 反代
```
proxy_pass http://[2409:8a4c:8004:f433:a0f2:15b:78d2:9327];
proxy_set_header Host rw2.cc;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
```
服务器环境是
OpenResty 1.21.4.1
求助大佬解答
#proxy #set #header #remote #addr #cf #nginx #反代 #pass #http
用 cf 太慢,我想用 nginx 反代
```
proxy_pass http://[2409:8a4c:8004:f433:a0f2:15b:78d2:9327];
proxy_set_header Host rw2.cc;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
```
服务器环境是
OpenResty 1.21.4.1
求助大佬解答
#proxy #set #header #remote #addr #cf #nginx #反代 #pass #http
Nginx 有办法单独重写 IP 被禁止时的状态码吗?
领导要求 IP 被 Nginx 禁止时返回 400 状态码而不是 Nginx 默认的 403 ,查了下 `error_page 403 400 /400.html;` 能把 403 全替换成 400 状态,但其它原因导致的 403 我不想动,有办法单独重写 IP 被禁止时的状态码吗?
(黑名单里是几万条机房 IP 段,不知道他们哪里搞来的,测了下还挺准,很小的商家都包括进去了)(因为不用经常变动,感觉在程序里拦效率很低,想直接在 Nginx 里拦)
#400 #403 #IP #Nginx #状态 #禁止 #替换成 #码而 #error #page
领导要求 IP 被 Nginx 禁止时返回 400 状态码而不是 Nginx 默认的 403 ,查了下 `error_page 403 400 /400.html;` 能把 403 全替换成 400 状态,但其它原因导致的 403 我不想动,有办法单独重写 IP 被禁止时的状态码吗?
(黑名单里是几万条机房 IP 段,不知道他们哪里搞来的,测了下还挺准,很小的商家都包括进去了)(因为不用经常变动,感觉在程序里拦效率很低,想直接在 Nginx 里拦)
#400 #403 #IP #Nginx #状态 #禁止 #替换成 #码而 #error #page
flask + nginx + uwsgi +docker-compose
docker-compose.yml:
version: "3.3"
services:
flask_app:
build: ./flask_app
container_name: flask_app
restart: always
environment:
- APP_NAME=MyFlaskApp
expose:
- 8080
nginx:
build: ./nginx
container_name: nginx
restart: always
ports:
- "80:80"
nginx.conf
server {
listen 80;
charset UTF-8;
client_max_body_size 30M;
location / {
include uwsgi_params;
uwsgi_pass flask:8080;
}
}
uwsgi.ini
[uwsgi]
wsgi-file = app.py
callable = app
socket = :8080
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
buffer-size = 65535
limit-post = 104857600
logto = /flask_app/app.log
Dockerfile
FROM python:3.6
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
CMD ["uwsgi", "uwsgi.ini"]
以上分别是我 docker-compose, nginx, uwsgi 以及 dockerfile 的配置,但是启动话只有 nginx 启动了,另外一个一直在重启的状态,求解
#app #uwsgi #nginx #flask #8080 #80 #true #docker #compose #build
docker-compose.yml:
version: "3.3"
services:
flask_app:
build: ./flask_app
container_name: flask_app
restart: always
environment:
- APP_NAME=MyFlaskApp
expose:
- 8080
nginx:
build: ./nginx
container_name: nginx
restart: always
ports:
- "80:80"
nginx.conf
server {
listen 80;
charset UTF-8;
client_max_body_size 30M;
location / {
include uwsgi_params;
uwsgi_pass flask:8080;
}
}
uwsgi.ini
[uwsgi]
wsgi-file = app.py
callable = app
socket = :8080
processes = 4
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
buffer-size = 65535
limit-post = 104857600
logto = /flask_app/app.log
Dockerfile
FROM python:3.6
WORKDIR /app
ADD . /app
RUN pip install -r requirements.txt
CMD ["uwsgi", "uwsgi.ini"]
以上分别是我 docker-compose, nginx, uwsgi 以及 dockerfile 的配置,但是启动话只有 nginx 启动了,另外一个一直在重启的状态,求解
#app #uwsgi #nginx #flask #8080 #80 #true #docker #compose #build
静态资源通过 jwt 鉴权有什么现成的高性能轮子吗
就是某个路径下的资源要判断 jwt 字段`subscribed`为 1 且 jwt 没过期才能访问,否则返回 403
本来打算用 worker intercept 试试,后来看了下还是直接把 jwt 塞进 cookies 方便,只能用来获取资源的 jwt 不防跨站也没什么安全隐患
静态资源在独立的服务器上
自己写一个的话缓存不好实现,访问量不小,预算给的又少
(现在的做法是登录会员账号后往 cookies 里写固定 key ,nginx 直接两个 if 判断密码对不对,太不安全了,所有用户共用相同 key 很容易有人分享出去)
#jwt #cookies #key #资源 #subscribed #403 #worker #intercept #后往 #nginx
就是某个路径下的资源要判断 jwt 字段`subscribed`为 1 且 jwt 没过期才能访问,否则返回 403
本来打算用 worker intercept 试试,后来看了下还是直接把 jwt 塞进 cookies 方便,只能用来获取资源的 jwt 不防跨站也没什么安全隐患
静态资源在独立的服务器上
自己写一个的话缓存不好实现,访问量不小,预算给的又少
(现在的做法是登录会员账号后往 cookies 里写固定 key ,nginx 直接两个 if 判断密码对不对,太不安全了,所有用户共用相同 key 很容易有人分享出去)
#jwt #cookies #key #资源 #subscribed #403 #worker #intercept #后往 #nginx
这个 trojan 脚本大佬的 trojan 怎么和 nginx 共用 443 的哈~
是这个大佬的脚本 ->https://github.com/jinwyp/one_click_script
我看星星很多,想去抄抄配置,没想美白哈
这 nginx 主配置
```
# user www-data www-data;
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log /nginxweb/nginx-access.log main;
error_log /nginxweb/nginx-error.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 120;
client_max_body_size 20m;
gzip on;
include /etc/nginx/conf.d/*.conf;
}
```
这是网站的 nginx 配置
```
server {
listen 80;
server_name domain.net;
root /nginxweb/html;
index index.php index.html index.htm;
location /75f0d3d7 {
proxy_pass http://127.0.0.1:27493;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
这是 trojan 的配置
```
{
"run_type": "server",
"local_addr": "0.0.0.0",
"local_port": 443,
"remote_addr": "127.0.0.1",
"remote_port": 80,
"password": [
"123",
"12345"
],
"log_level": 1,
"log_file": "/root/trojan-access.log",
"ssl": {
"verify": true,
"verify_hostname": true,
"cert": "/nginxweb/cert/fullchain.cer",
"key": "/nginxweb/cert/private.key",
"sni": "domain.net",
"fallback_addr": "127.0.0.1",
"fallback_port": 80,
"fingerprint": "chrome"
},
"websocket": {
"enabled": true,
"path": "/0a195182",
"host": "domain.net"
}
}
```
netstat -tlnp|grep 27493 也没看到 27493 端口有啥活动哈,链接不上的感觉哈~
#log #nginx #http #proxy #remote #addr #nginxweb #set #header #user
是这个大佬的脚本 ->https://github.com/jinwyp/one_click_script
我看星星很多,想去抄抄配置,没想美白哈
这 nginx 主配置
```
# user www-data www-data;
user root;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log /nginxweb/nginx-access.log main;
error_log /nginxweb/nginx-error.log;
sendfile on;
#tcp_nopush on;
keepalive_timeout 120;
client_max_body_size 20m;
gzip on;
include /etc/nginx/conf.d/*.conf;
}
```
这是网站的 nginx 配置
```
server {
listen 80;
server_name domain.net;
root /nginxweb/html;
index index.php index.html index.htm;
location /75f0d3d7 {
proxy_pass http://127.0.0.1:27493;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
这是 trojan 的配置
```
{
"run_type": "server",
"local_addr": "0.0.0.0",
"local_port": 443,
"remote_addr": "127.0.0.1",
"remote_port": 80,
"password": [
"123",
"12345"
],
"log_level": 1,
"log_file": "/root/trojan-access.log",
"ssl": {
"verify": true,
"verify_hostname": true,
"cert": "/nginxweb/cert/fullchain.cer",
"key": "/nginxweb/cert/private.key",
"sni": "domain.net",
"fallback_addr": "127.0.0.1",
"fallback_port": 80,
"fingerprint": "chrome"
},
"websocket": {
"enabled": true,
"path": "/0a195182",
"host": "domain.net"
}
}
```
netstat -tlnp|grep 27493 也没看到 27493 端口有啥活动哈,链接不上的感觉哈~
#log #nginx #http #proxy #remote #addr #nginxweb #set #header #user
nginx 配置完访问网站提示“您的连接不是私密连接”
本人 nginx 新手
背景说明:
1 、路由器开通了公网地址,通过 shareddns 自动更新域名解析( ali ),同时做了内网的端口转发。
2 、自己有一个虚拟黑群晖,黑群晖通过 acme.sh 使用 ali 的 RAM API (用户为 A )生成了泛域名( xxx.com );所有 docker 服务能通过黑群晖的反向代理,在公网使用 https 的域名+转发的端口方式访问进来。
3 、考虑到黑群晖性能瓶颈问题,也为了方便在 web 端管理内网的所有东西,搭了一个新的 centos7.6 ,并且完善了相应的工具,可以在内网成功实现 web 端的访问。
需求及条件描述:
port1 = 本身的端口
port2 = 转发的端口
1 、能通过 https://xxx.com:port2 的方式访问到内网 centos 里 docker 中的某一个容器的应用服务。
2 、已经做了对应端口转发及 nginx 配置(附后)
3 、centos 容器中的网络端口未使用 host 方式。
4 、centos 本地可通过 http://ip:port1 的方式正常访问。
5 、内网可通过 http://ip:port 的方式访问
6 、不做 https 的话,在外网可通过 http://xxx.com:port2 的方式进行不安全的访问
7 、centos 的 nginx 通过 acme.sh 生成了证书并且跟 nginx 服务做了关联,能自动更新证书(域名依旧是:xxx.com ) ---- 之前使用新的 RAM API 生成,后来改成跟黑群晖一样的 API 生成
8 、centos 的 hosts 及 hostname 都设置了 xxx.com
9 、已关闭 SELinux ,防火墙对应端口已放开
问题来了:
在 nginx 上监听 port 的 ssl,再用 https://xxx.com:port2 的方式访问就提示“您的连接不是私密连接”
请问该如何修改呢。恳请大佬支招,感谢!
附 ngixn 配置:
默认配置中,通过 include /etc/nginx/vhost/*.conf; 额外引入
server {
listen port2 ssl;
ssl_certificate /etc/nginx/ssl/xxx.com.cer;
ssl_certificate_key /etc/nginx/ssl/xxx.com.key;
server_name xxx.com;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
client_max_body_size 10M;
location / {
proxy_pass http://ip:port1;
proxy_redirect http://$host/ http://$http_host/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
#ssl #xxx #com #nginx #http #proxy #端口 #port2 #centos #访问
本人 nginx 新手
背景说明:
1 、路由器开通了公网地址,通过 shareddns 自动更新域名解析( ali ),同时做了内网的端口转发。
2 、自己有一个虚拟黑群晖,黑群晖通过 acme.sh 使用 ali 的 RAM API (用户为 A )生成了泛域名( xxx.com );所有 docker 服务能通过黑群晖的反向代理,在公网使用 https 的域名+转发的端口方式访问进来。
3 、考虑到黑群晖性能瓶颈问题,也为了方便在 web 端管理内网的所有东西,搭了一个新的 centos7.6 ,并且完善了相应的工具,可以在内网成功实现 web 端的访问。
需求及条件描述:
port1 = 本身的端口
port2 = 转发的端口
1 、能通过 https://xxx.com:port2 的方式访问到内网 centos 里 docker 中的某一个容器的应用服务。
2 、已经做了对应端口转发及 nginx 配置(附后)
3 、centos 容器中的网络端口未使用 host 方式。
4 、centos 本地可通过 http://ip:port1 的方式正常访问。
5 、内网可通过 http://ip:port 的方式访问
6 、不做 https 的话,在外网可通过 http://xxx.com:port2 的方式进行不安全的访问
7 、centos 的 nginx 通过 acme.sh 生成了证书并且跟 nginx 服务做了关联,能自动更新证书(域名依旧是:xxx.com ) ---- 之前使用新的 RAM API 生成,后来改成跟黑群晖一样的 API 生成
8 、centos 的 hosts 及 hostname 都设置了 xxx.com
9 、已关闭 SELinux ,防火墙对应端口已放开
问题来了:
在 nginx 上监听 port 的 ssl,再用 https://xxx.com:port2 的方式访问就提示“您的连接不是私密连接”
请问该如何修改呢。恳请大佬支招,感谢!
附 ngixn 配置:
默认配置中,通过 include /etc/nginx/vhost/*.conf; 额外引入
server {
listen port2 ssl;
ssl_certificate /etc/nginx/ssl/xxx.com.cer;
ssl_certificate_key /etc/nginx/ssl/xxx.com.key;
server_name xxx.com;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 10m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_prefer_server_ciphers on;
client_max_body_size 10M;
location / {
proxy_pass http://ip:port1;
proxy_redirect http://$host/ http://$http_host/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
}
}
#ssl #xxx #com #nginx #http #proxy #端口 #port2 #centos #访问
[emerg] "stream" directive is not allowed 怎么解哈,已经安装了模块
安装的是 oneinstack,
在 nginx.conf 插入 stream 代码的时候报错,
显示的是`nginx: [emerg] "stream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:86`
```
stream {
map $ssl_preread_server_name $backend_name {
test.domain.net trojan;
test1.domain.net web;
test2.domain.net web;
}
upstream trojan {
server 127.0.0.1:50443;
}
upstream web {
server 127.0.0.1:445;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass $backend_name;
ssl_preread on;
}
}
```
网上普遍反应是没有安装模块,但似乎是装了的哈
```
nginx version: nginx/1.22.1
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1s --with-pcre=../pcre-8.45 --with-pcre-jit --with-ld-opt=-ljemalloc
```
感谢
#-- #module #http #nginx #stream #ssl #server #conf #preread #name
安装的是 oneinstack,
在 nginx.conf 插入 stream 代码的时候报错,
显示的是`nginx: [emerg] "stream" directive is not allowed here in /usr/local/nginx/conf/nginx.conf:86`
```
stream {
map $ssl_preread_server_name $backend_name {
test.domain.net trojan;
test1.domain.net web;
test2.domain.net web;
}
upstream trojan {
server 127.0.0.1:50443;
}
upstream web {
server 127.0.0.1:445;
}
server {
listen 443 reuseport;
listen [::]:443 reuseport;
proxy_pass $backend_name;
ssl_preread on;
}
}
```
网上普遍反应是没有安装模块,但似乎是装了的哈
```
nginx version: nginx/1.22.1
built by gcc 8.3.0 (Debian 8.3.0-6)
built with OpenSSL 1.1.1s 1 Nov 2022
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-http_ssl_module --with-stream --with-stream_ssl_preread_module --with-stream_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1s --with-pcre=../pcre-8.45 --with-pcre-jit --with-ld-opt=-ljemalloc
```
感谢
#-- #module #http #nginx #stream #ssl #server #conf #preread #name
想实现一个 nginx 的动态扩充 connections 的功能
目前手上的项目是 fork 的 nginx ,业务因为觉得默认设置一个大的 worker\_connections 会占用太多容器内存,所以想实现一个动态调整 ngx\_connection\_t 的功能,目前我设想了两个方案,希望可以讨论一下可行性。
1. 直接使用 nginx 自带的 reload 的方法,这个实现起来应该比较简单。
2. 调整数组 ngx\_connection\_t 的大小,这个就必须 new 一个新的数组再拷贝原数组的内容到新数组,同时可能还会涉及到一些并发的问题,如果在这里加锁也许会导致拷贝期间 nginx 不能对外服务?但是 new 一个新的数组开销可能比 new 一个 worker 小一点。
目前我可能更倾向于方法 1 ,总体工作量小一点而且不影响对外服务。
#数组 #nginx #new #worker #ngx #connection #拷贝 #一个 #默认设置 #加锁
目前手上的项目是 fork 的 nginx ,业务因为觉得默认设置一个大的 worker\_connections 会占用太多容器内存,所以想实现一个动态调整 ngx\_connection\_t 的功能,目前我设想了两个方案,希望可以讨论一下可行性。
1. 直接使用 nginx 自带的 reload 的方法,这个实现起来应该比较简单。
2. 调整数组 ngx\_connection\_t 的大小,这个就必须 new 一个新的数组再拷贝原数组的内容到新数组,同时可能还会涉及到一些并发的问题,如果在这里加锁也许会导致拷贝期间 nginx 不能对外服务?但是 new 一个新的数组开销可能比 new 一个 worker 小一点。
目前我可能更倾向于方法 1 ,总体工作量小一点而且不影响对外服务。
#数组 #nginx #new #worker #ngx #connection #拷贝 #一个 #默认设置 #加锁
uwsgi 和 nginx 部署 flask 项目
nginx 起来了,但是项目起不起来,报错:unable to load configuration from -,这是哪个配置文件出错了呢,Dockerfile ,uwsgi.ini 还是 nginx.conf 呢
补充:是用 docker-compose 启动的容器
#nginx #报错 #配置文件 #unable #load #configuration #Dockerfile #uwsgi #ini #conf
nginx 起来了,但是项目起不起来,报错:unable to load configuration from -,这是哪个配置文件出错了呢,Dockerfile ,uwsgi.ini 还是 nginx.conf 呢
补充:是用 docker-compose 启动的容器
#nginx #报错 #配置文件 #unable #load #configuration #Dockerfile #uwsgi #ini #conf