我对 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' 成功运行上述内容