Alpine Nginx で静的ファイルをホストするだけの単純な設定

投稿者: ytyng 1年, 7ヶ月 前

結局、元の nginx.conf は上書きすることにした。

Dockerfile

FROM alpine:3.16

RUN apk --no-cache add nginx

COPY nginx.conf /etc/nginx/nginx.conf
COPY html /var/www/localhost/htdocs

EXPOSE 80
CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

nginx.conf

# /etc/nginx/nginx.conf
user nginx;
# worker_processes auto;
worker_processes 1;

pcre_jit on;
error_log /dev/stderr warn;

events {
worker_connections 128;
}

http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;
client_max_body_size 1m;
sendfile on;
tcp_nopush on;
gzip_vary on;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
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 /dev/stdout main;

server {
root /var/www/localhost/htdocs;
}
}
現在未評価

コメント

アーカイブ

2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011