【发布时间】:2021-06-24 12:39:37
【问题描述】:
我对 Nginx 非常陌生,并注意到每当我在本地访问我的服务器时,它都会记录下来。我想知道,我需要创建哪些配置文件(以及我将它们放在哪里)以及我必须在其中放入什么来禁用该行为(我试图防止喷出)。我在 aws 上运行我的应用程序,并收到很多形式为 '172.31.22.19 - - [23/Jun/2021:23:38:33 +0000] "GET / HTTP/1.1" 200 3022 "- " "ELB-HealthChecker/2.0" "-"' 有没有办法禁用它?还是我需要禁用所有功能?
我的 docker 文件是:
# pull official base image
FROM node:16 AS builder
# set working directory
WORKDIR /app
# install app dependencies
#copies package.json and package-lock.json to Docker environment
COPY package.json ./
# Installs all node packages
RUN npm install
# Copies everything over to Docker environment
COPY . ./
RUN npm run build
#Stage 2
#######################################
#pull the official nginx:1.19.0 base image
FROM nginx:1.19.0
#copies React to the container directory
# Set working directory to nginx resources directory
WORKDIR /usr/share/nginx/html
# Remove default nginx static resources
RUN rm -rf ./*
# Copies static resources from builder stage
COPY --from=builder /app/build .
EXPOSE 80
# Containers run nginx with global directives and daemon off
ENTRYPOINT ["nginx", "-g", "daemon off;"]
我可以使用 'docker run -p 80:80 my-app' 成功运行上述内容
【问题讨论】: