Skip to content

Instantly share code, notes, and snippets.

@hfm
Created February 10, 2017 16:35
Show Gist options
  • Save hfm/4a045a429f9303c90eac7c348d1a424a to your computer and use it in GitHub Desktop.
Save hfm/4a045a429f9303c90eac7c348d1a424a to your computer and use it in GitHub Desktop.
FROM centos:7
MAINTAINER OKUMURA Takahiro <[email protected]>
RUN echo -e "[nginx]\n\
name=nginx repo\n\
baseurl=http://nginx.org/packages/mainline/centos/7/\$basearch/\n\
gpgcheck=0\n\
enabled=1\n\
" > /etc/yum.repos.d/nginx.repo
RUN yum install -y nginx
RUN mkdir /etc/nginx/ssl
RUN for CNT in $(seq -w 1 10000); do openssl req -x509 -nodes -newkey rsa:2048 -keyout /etc/nginx/ssl/sample${CNT}.local.key -out /etc/nginx/ssl/sample${CNT}.local.crt -subj "/C=JP/CN=sample${CNT}.local" 2>/dev/null; done
RUN for CNT in $(seq -w 1 10000); do COMMON_NAME=sample${CNT}.local; echo -e "server {\n\
listen 443 ssl;\n\
server_name ${COMMON_NAME};\n\
ssl_certificate /etc/nginx/ssl/${COMMON_NAME}.crt;\n\
ssl_certificate_key /etc/nginx/ssl/${COMMON_NAME}.key;\n\
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;\n\
ssl_ciphers HIGH:!aNULL:!MD5;\n\
ssl_prefer_server_ciphers on;\n\
location / {\n\
root /usr/share/nginx/html;\n\
index index.html;\n\
}\n\
}\n" > /etc/nginx/conf.d/${COMMON_NAME}.conf; done
RUN sed -i '18i server_names_hash_max_size 10240;' /etc/nginx/nginx.conf
RUN sed -i '19i server_names_hash_bucket_size 128;' /etc/nginx/nginx.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment