Skip to content

Commit

Permalink
Update nginx example in README
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Oct 5, 2022
1 parent 3f2ef3c commit 161bb34
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,44 @@ Images are built primarily for `amd64` architecture, and may also include builds
* Set various [environment variables](#environment-variables) to understand the capabilities of this image.
* Map [persistent storage](#data-volumes) for access to configuration and data files for backup.

The container starts up and reads from `/etc/nginx/nginx.conf` for some basic configuration and to listen on port 73 internally for Nginx Status responses. Configuration of websites are done in `/etc/services.available` with the filename pattern of `site.conf`. You must set an environment variable for `NGINX_SITE_ENABLED` if you have more than one configuration in there if you only want to enable one of the configurartions, otherwise it will enable all of them. Use `NGINX_SITE_ENABLED=null` to break a parent image declaration.

Use this as a starting point for your site configurations:
````nginx
server {
### Don't Touch This
listen {{NGINX_LISTEN_PORT}};
server_name localhost;
root {{NGINX_WEBROOT}};
### Populate your custom directives here
index index.php index.html index.htm;
location / {
try_files \$uri \$uri/ /index.php?\$args;
}
### Populate your custom directives here
location ~ \.php(/|\$) {
include /etc/nginx/snippets/php-fpm.conf;
fastcgi_split_path_info ^(.+?\.php)(/.+)\$;
fastcgi_param PATH_INFO \$fastcgi_path_info;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
}
# Deny access to any files with a .php extension in the uploads directory
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
### Don't edit past here
include /etc/nginx/snippets/site_optimization.conf;
include /etc/nginx/snippets/exploit_protection.conf;
}
````

### Persistent Storage

The container starts up and reads from `/etc/nginx/nginx.conf` for some basic configuration and to listen on port 73 internally for Nginx Status responses. `/etc/nginx/conf.d` contains a sample configuration file that can be used to customize a nginx server block.
Expand Down

0 comments on commit 161bb34

Please sign in to comment.