Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Commit

Permalink
add docker-compose file, .dockerignore rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lucmski committed Sep 23, 2019
1 parent 12a4029 commit d113797
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
hoaxy_botometer_flowchart.png
*.pdf
*.doc
*.txt
.git
.git/
.git/*
.git/**
docker-compose.*
config.example.js
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
services:
php:
image: php:7.2-fpm-alpine3.8
volumes:
- ./code:/code

web:
image: nginx:1-alpine
ports:
- "8080:80"
links:
- php
volumes:
- ./code:/code
- ./nginx.conf:/etc/nginx/conf.d/default.conf
63 changes: 63 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
server {
listen 80 default_server;
server_name _;
index index.php index.html;
root /code/;

error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;

# Hide Nginx Server Version
server_tokens off;

# Size Limits & Buffer Overflows
client_body_buffer_size 100K;
client_header_buffer_size 1k;
client_max_body_size 100k;
large_client_header_buffers 2 1k;

# Allow a larger response buffer
subrequest_output_buffer_size 100k;

# X-Frame-Options is to prevent from clickJacking attack
add_header X-Frame-Options "SAMEORIGIN";

# Disable content-type sniffing on some browsers.
add_header X-Content-Type-Options "nosniff";

# This header enables the Cross-site scripting (XSS) filter
add_header X-XSS-Protection "1; mode=block";

# This will enforce HTTP browsing into HTTPS and avoid ssl stripping attack
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";

# Limit HTTP methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 405;
}

# Deny access to (dot) hidden files
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}

# Serve static assets
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 7d;
}

# Handle PHP reverse proxy
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
4 changes: 4 additions & 0 deletions php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# TODO: Add hardened php configs
# https://www.owasp.org/index.php/PHP_Configuration_Cheat_Sheet
# https://gist.github.com/yohang88/bab3c43eb2f4414eafd0cb145548651d
# https://www.if-not-true-then-false.com/2011/nginx-and-php-fpm-configuration-and-optimizing-tips-and-tricks/

0 comments on commit d113797

Please sign in to comment.