Skip to content

Instantly share code, notes, and snippets.

@psycalc
Created September 21, 2021 07:26
Show Gist options
  • Save psycalc/038db8913dab49d5d37faf921670e110 to your computer and use it in GitHub Desktop.
Save psycalc/038db8913dab49d5d37faf921670e110 to your computer and use it in GitHub Desktop.
create nginx config throu Dockerfile (for i.e laravel nginx config from alpine base image)
RUN echo $'# This is a default site configuration which will simply return 404, preventing\n\
# chance access to any other virtualhost.\n\
server {\n\
listen 80 default_server;\n\
listen [::]:80 default_server;\n\
# Everything is a 404\n\
location / {\n\
return 404;\n\
}\n\
# You may need this to prevent return 404 recursion.\n\
location = /404.html {\n\
internal;\n\
}\n\
location ~ \.php$ {\n\
fastcgi_pass 127.0.0.1:9000;\n\
fastcgi_index index.php;\n\
include fastcgi.conf;\n\
}\n\
}' > /etc/nginx/http.d/default.conf
# rc-service nginx restart && \
# rc-service php-fpm7 restart
ENTRYPOINT ["/bin/ash", "-c", "sleep infinity"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment