Skip to content

Instantly share code, notes, and snippets.

@falexandre
Last active October 30, 2017 23:39
Show Gist options
  • Save falexandre/a003c1ae8191e258a319fd9edf756aed to your computer and use it in GitHub Desktop.
Save falexandre/a003c1ae8191e258a319fd9edf756aed to your computer and use it in GitHub Desktop.
Docker-nginx
RewriteEngine on
### Não permite exibir o mapa dos diretorios
Options -Indexes
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^ index.html [L]
server {
listen 80;
# this path MUST be exactly as docker-compose.fpm.volumes,
# even if it doesn't exists in this dock.
root /usr/share/nginx/html;
index index.php index.html index.html;
server_name lojavirtual;
location / {
try_files $uri /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass phpfpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
nginx:
image: tutum/nginx
ports:
- "80:80"
links:
- phpfpm
volumes:
- ./nginx/default:/etc/nginx/sites-available/default
- ./nginx/default:/etc/nginx/sites-enabled/default
- ./logs/nginx-error.log:/var/log/nginx/error.log
- ./logs/nginx-access.log:/var/log/nginx/access.log
phpfpm:
image: php:fpm
ports:
- "9000:9000"
volumes:
- ./public:/usr/share/nginx/html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment