【发布时间】:2020-10-17 14:58:10
【问题描述】:
我在我的 nginx default.conf 中添加了一个 server_name server_name very.very.long.domain.name.used.in.this.example.org; 并出现此错误
nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64
我阅读了 nginx 文档,我说我必须将它添加到我的 http 上下文中
http {
. . .
server_names_hash_bucket_size 64;
. . .
}
我在 Nginx 目录下创建了一个 nginx.conf 并将其复制到 /etc/nginx/nginx.conf 中
nginx.conf
worker_processes 1;
events {
worker_connections 4096;
}
http {
server_names_hash_bucket_size 64;
server_names_hash_max_size 512;
}
Dockerfile
FROM nginx
COPY ./default.conf /etc/nginx/conf.d/default.conf
COPY ./nginx.conf /etc/nginx/nginx.conf
但是现在 nginx 不服务默认端口 80
server {
listen 80;
server_name very.very.long.domain.name.used.in.this.example.org;;
location / {
proxy_pass http://admin;
}
}
【问题讨论】:
标签: docker nginx nginx-config