Closed doedje closed 1 year ago
As requested in #98
If you just want to redefine a different server-block you can put .conf files in your conf.d directory like:
# conf.d/redirect.conf server { listen 80 default_server; listen [::]:80 default_server; return 301 https://$host$request_uri; }
and
# conf.d/my-https-site.conf server { listen 443 default_server ssl; listen [::]:443 default_server ssl; ... }
You can now run the image as a new container with:
docker run -v "`pwd`/conf.d:/etc/nginx/conf.d" -p 80:80 -p 443:443 trafex/php-nginx
NOTE: don't forget to add a server-block for the healthcheck:
# conf.d/healthcheck.conf server { listen 8080; listen [::]:8080; # Allow fpm ping and status from localhost location ~ ^/(fpm-status|fpm-ping)$ { access_log off; allow 127.0.0.1; deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/run/php-fpm.sock; } }
_EDIT: removed 'defaultserver' from the healthcheck server-block and fixed a typo
Hi @doedje,
Thank you for your contribution! That's indeed exactly what's needed to split the http and server config. I'll merge this in. Nice work!
As requested in #98
If you just want to redefine a different server-block you can put .conf files in your conf.d directory like:
and
You can now run the image as a new container with:
NOTE: don't forget to add a server-block for the healthcheck:
_EDIT: removed 'defaultserver' from the healthcheck server-block and fixed a typo