more changes to get dockerization working
This commit is contained in:
parent
073e307f33
commit
edadfd5c68
7 changed files with 191 additions and 65 deletions
|
@ -1,4 +1,4 @@
|
|||
version: '2'
|
||||
version: '3'
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:3.4.7
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
version: '2'
|
||||
version: '3'
|
||||
services:
|
||||
mongo:
|
||||
image: mongo:3.4.7
|
||||
expose:
|
||||
- "27017"
|
||||
nginx:
|
||||
build: ./nginx
|
||||
server:
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"env": {
|
||||
"NODE_ENV": "production"
|
||||
},
|
||||
"instances" : 2,
|
||||
"instances" : "max",
|
||||
"exec_mode" : "cluster"
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
FROM nginx:1.13.12
|
||||
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
RUN mkdir /etc/nginx/sites-enabled
|
||||
COPY alpha.editor.p5js.org.conf /etc/nginx/sites-enabled
|
61
nginx/alpha.editor.p5js.org.conf
Normal file
61
nginx/alpha.editor.p5js.org.conf
Normal file
|
@ -0,0 +1,61 @@
|
|||
# HTTP - redirect all requests to HTTPS:
|
||||
server {
|
||||
listen 80;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
location ~* \/login(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/signup(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/reset-password(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/alpha.editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/alpha.editor.p5js.org/privkey.pem;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 http://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/editor.p5js.org/privkey.pem;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 https://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
122
nginx/nginx-aws.conf
Normal file
122
nginx/nginx-aws.conf
Normal file
|
@ -0,0 +1,122 @@
|
|||
# For more information on configuration, see:
|
||||
# * Official English Documentation: http://nginx.org/en/docs/
|
||||
# * Official Russian Documentation: http://nginx.org/ru/docs/
|
||||
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
error_log /var/log/nginx/error.log;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||
# for more information.
|
||||
include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
include /etc/nginx/sites-enabled/*.conf;
|
||||
|
||||
index index.html index.htm;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
server_name localhost;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# Load configuration files for the default server block.
|
||||
include /etc/nginx/default.d/*.conf;
|
||||
|
||||
location / {
|
||||
}
|
||||
|
||||
# redirect server error pages to the static page /40x.html
|
||||
#
|
||||
error_page 404 /404.html;
|
||||
location = /40x.html {
|
||||
}
|
||||
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
}
|
||||
|
||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# proxy_pass http://127.0.0.1;
|
||||
#}
|
||||
|
||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
|
||||
#
|
||||
#location ~ \.php$ {
|
||||
# root html;
|
||||
# fastcgi_pass 127.0.0.1:9000;
|
||||
# fastcgi_index index.php;
|
||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
|
||||
# include fastcgi_params;
|
||||
#}
|
||||
|
||||
# deny access to .htaccess files, if Apache's document root
|
||||
# concurs with nginx's one
|
||||
#
|
||||
#location ~ /\.ht {
|
||||
# deny all;
|
||||
#}
|
||||
}
|
||||
|
||||
|
||||
# Settings for a TLS enabled server.
|
||||
#
|
||||
# server {
|
||||
# listen 443 ssl;
|
||||
# listen [::]:443 ssl;
|
||||
# server_name localhost;
|
||||
# root /usr/share/nginx/html;
|
||||
#
|
||||
# ssl_certificate "/etc/pki/nginx/server.crt";
|
||||
# ssl_certificate_key "/etc/pki/nginx/private/server.key";
|
||||
# # It is *strongly* recommended to generate unique DH parameters
|
||||
# # Generate them with: openssl dhparam -out /etc/pki/nginx/dhparams.pem 2048
|
||||
# #ssl_dhparam "/etc/pki/nginx/dhparams.pem";
|
||||
# ssl_session_cache shared:SSL:1m;
|
||||
# ssl_session_timeout 10m;
|
||||
# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
|
||||
# ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP;
|
||||
# ssl_prefer_server_ciphers on;
|
||||
#
|
||||
# # Load configuration files for the default server block.
|
||||
# include /etc/nginx/default.d/*.conf;
|
||||
#
|
||||
# location / {
|
||||
# }
|
||||
#
|
||||
# error_page 404 /404.html;
|
||||
# location = /40x.html {
|
||||
# }
|
||||
#
|
||||
# error_page 500 502 503 504 /50x.html;
|
||||
# location = /50x.html {
|
||||
# }
|
||||
# }
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
# HTTP - redirect all requests to HTTPS:
|
||||
server {
|
||||
listen 80;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
location ~* \/login(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/signup(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* \/reset-password(\/)* {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/alpha.editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/alpha.editor.p5js.org/privkey.pem;
|
||||
server_name alpha.editor.p5js.org;
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 http://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443;
|
||||
ssl on;
|
||||
ssl_certificate /etc/letsencrypt/live/editor.p5js.org/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/editor.p5js.org/privkey.pem;
|
||||
server_name editor.p5js.org;
|
||||
location ~ ^/(.*) {
|
||||
return 302 https://alpha.editor.p5js.org/$1;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue