summaryrefslogtreecommitdiff
path: root/nginx
diff options
context:
space:
mode:
Diffstat (limited to 'nginx')
-rw-r--r--nginx/Dockerfile18
-rw-r--r--nginx/nginx.conf30
-rw-r--r--nginx/sites/.gitignore3
-rw-r--r--nginx/sites/default.conf30
-rw-r--r--nginx/sites/sample.conf.example28
-rw-r--r--nginx/sites/vainsocial.dev.conf25
6 files changed, 134 insertions, 0 deletions
diff --git a/nginx/Dockerfile b/nginx/Dockerfile
new file mode 100644
index 0000000..1a1db96
--- /dev/null
+++ b/nginx/Dockerfile
@@ -0,0 +1,18 @@
+FROM nginx:alpine
+
+MAINTAINER Mahmoud Zalt <mahmoud@zalt.me>
+
+ADD nginx.conf /etc/nginx/
+
+ARG PHP_UPSTREAM=php-fpm
+
+RUN apk update \
+ && apk upgrade \
+ && apk add --no-cache bash \
+ && adduser -D -H -u 1000 -s /bin/bash www-data \
+ && rm /etc/nginx/conf.d/default.conf \
+ && echo "upstream php-upstream { server ${PHP_UPSTREAM}:9000; }" > /etc/nginx/conf.d/upstream.conf
+
+CMD ["nginx"]
+
+EXPOSE 80 443
diff --git a/nginx/nginx.conf b/nginx/nginx.conf
new file mode 100644
index 0000000..97e5a0e
--- /dev/null
+++ b/nginx/nginx.conf
@@ -0,0 +1,30 @@
+user www-data;
+worker_processes 4;
+pid /run/nginx.pid;
+daemon off;
+
+events {
+ worker_connections 2048;
+ multi_accept on;
+ use epoll;
+}
+
+http {
+ server_tokens off;
+ sendfile on;
+ tcp_nopush on;
+ tcp_nodelay on;
+ keepalive_timeout 15;
+ types_hash_max_size 2048;
+ client_max_body_size 20M;
+ include /etc/nginx/mime.types;
+ default_type application/octet-stream;
+ access_log /var/log/nginx/access.log;
+ error_log /var/log/nginx/error.log;
+ gzip on;
+ gzip_disable "msie6";
+ include /etc/nginx/conf.d/*.conf;
+ include /etc/nginx/sites-available/*;
+ open_file_cache max=100;
+ charset UTF-8;
+}
diff --git a/nginx/sites/.gitignore b/nginx/sites/.gitignore
new file mode 100644
index 0000000..0f0ea0e
--- /dev/null
+++ b/nginx/sites/.gitignore
@@ -0,0 +1,3 @@
+*.conf
+!default.conf
+!vainsocial.dev.conf \ No newline at end of file
diff --git a/nginx/sites/default.conf b/nginx/sites/default.conf
new file mode 100644
index 0000000..2ce47b5
--- /dev/null
+++ b/nginx/sites/default.conf
@@ -0,0 +1,30 @@
+server {
+
+ listen 80 default_server;
+ listen [::]:80 default_server ipv6only=on;
+
+ server_name laradock;
+ root /var/www/public;
+ index index.php index.html index.htm;
+
+ location / {
+ try_files $uri $uri/ /index.php$is_args$args;
+ }
+
+ location ~ \.php$ {
+ try_files $uri /index.php =404;
+ fastcgi_pass php-upstream;
+ fastcgi_index index.php;
+ fastcgi_buffers 16 16k;
+ fastcgi_buffer_size 32k;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+
+ location ~ /\.ht {
+ deny all;
+ }
+}
+
+
+
diff --git a/nginx/sites/sample.conf.example b/nginx/sites/sample.conf.example
new file mode 100644
index 0000000..e6520e5
--- /dev/null
+++ b/nginx/sites/sample.conf.example
@@ -0,0 +1,28 @@
+server {
+
+ listen 80;
+ listen [::]:80;
+
+ server_name sample.dev;
+ root /var/www/sample/public;
+ index index.php index.html index.htm;
+
+ location / {
+ try_files $uri $uri/ /index.php$is_args$args;
+ }
+
+ location ~ \.php$ {
+ try_files $uri /index.php =404;
+ fastcgi_pass php-upstream;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+
+ location ~ /\.ht {
+ deny all;
+ }
+}
+
+
+
diff --git a/nginx/sites/vainsocial.dev.conf b/nginx/sites/vainsocial.dev.conf
new file mode 100644
index 0000000..57491a2
--- /dev/null
+++ b/nginx/sites/vainsocial.dev.conf
@@ -0,0 +1,25 @@
+server {
+
+ listen 80;
+ listen [::]:80;
+
+ server_name vainsocial.dev;
+ root /var/www/vainsocial/public;
+ index index.php index.html index.htm;
+
+ location / {
+ try_files $uri $uri/ /index.php$is_args$args;
+ }
+
+ location ~ \.php$ {
+ try_files $uri /index.php =404;
+ fastcgi_pass php-upstream;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+
+ location ~ /\.ht {
+ deny all;
+ }
+}