get nginx proxying working on local machine
This commit is contained in:
parent
c7ce85e0d7
commit
d4b927f0d4
6 changed files with 85 additions and 76 deletions
|
@ -1,3 +1,12 @@
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "8.11.1"
|
- "8.11.1"
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
# eventually set up AWS stuff here
|
||||||
|
- docker-compose up -d
|
||||||
|
- docker ps -a
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ RUN npm install pm2 -g
|
||||||
RUN npm install local-ssl-proxy
|
RUN npm install local-ssl-proxy
|
||||||
COPY index.js ecosystem.json ./
|
COPY index.js ecosystem.json ./
|
||||||
COPY --from=build /usr/src/app/dist ./dist
|
COPY --from=build /usr/src/app/dist ./dist
|
||||||
RUN npm run ssl-proxy
|
# for reg production
|
||||||
#RUN npm run fetch-examples:prod
|
|
||||||
CMD ["pm2-runtime", "ecosystem.json"]
|
CMD ["pm2-runtime", "ecosystem.json"]
|
||||||
|
# for testing ssl locally
|
||||||
|
# CMD npm run ssl-proxy && pm2-runtime ecosystem.json
|
||||||
|
|
|
@ -6,9 +6,11 @@ services:
|
||||||
- dbdata:/data/db
|
- dbdata:/data/db
|
||||||
expose:
|
expose:
|
||||||
- "27017"
|
- "27017"
|
||||||
# nginx:
|
nginx:
|
||||||
# build: ./nginx
|
build: ./nginx
|
||||||
server:
|
ports:
|
||||||
|
- '80:80'
|
||||||
|
app:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
|
@ -17,15 +19,14 @@ services:
|
||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
- MONGO_URL=mongodb://mongo:27017/p5js-web-editor
|
||||||
- API_URL=https://localhost/api
|
# - API_URL=https://localhost/api
|
||||||
- PORT=80
|
# - PORT=80
|
||||||
volumes:
|
volumes:
|
||||||
- .:/opt/node/app
|
- .:/opt/node/app
|
||||||
- /opt/node/app/node_modules
|
- /opt/node/app/node_modules
|
||||||
ports:
|
ports:
|
||||||
- '8000:8000'
|
- '8000:8000'
|
||||||
- '80:80'
|
# - '443:443'
|
||||||
- '443:443'
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongo
|
- mongo
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
FROM nginx:1.13.12
|
FROM nginx:1.13.12
|
||||||
|
|
||||||
RUN mkdir -p /etc/nginx/sites-enabled
|
COPY alpha.editor.p5js.org.conf /etc/nginx/conf.d/default.conf
|
||||||
COPY nginx.conf /etc/nginx/nginx.conf
|
|
||||||
COPY alpha.editor.p5js.org.conf /etc/nginx/sites-enabled
|
|
|
@ -1,27 +1,27 @@
|
||||||
# HTTP - redirect all requests to HTTPS:
|
# HTTP - redirect all requests to HTTPS:
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name alpha.editor.p5js.org;
|
#server_name alpha.editor.p5js.org;
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://127.0.0.1:8000;
|
proxy_pass http://app:8000;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
}
|
}
|
||||||
location ~* \/login(\/)* {
|
# location ~* \/login(\/)* {
|
||||||
return 301 https://$host$request_uri;
|
# return 301 https://$host$request_uri;
|
||||||
}
|
# }
|
||||||
location ~* \/signup(\/)* {
|
# location ~* \/signup(\/)* {
|
||||||
return 301 https://$host$request_uri;
|
# return 301 https://$host$request_uri;
|
||||||
}
|
# }
|
||||||
location ~* \/reset-password(\/)* {
|
# location ~* \/reset-password(\/)* {
|
||||||
return 301 https://$host$request_uri;
|
# return 301 https://$host$request_uri;
|
||||||
}
|
# }
|
||||||
location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
# location ~* "\/[a-zA-Z0-9._-]{1,20}\/account(\/)*" {
|
||||||
return 301 https://$host$request_uri;
|
# return 301 https://$host$request_uri;
|
||||||
}
|
# }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,13 +41,13 @@
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
|
|
||||||
server {
|
# server {
|
||||||
listen 80;
|
# listen 80;
|
||||||
server_name editor.p5js.org;
|
# server_name editor.p5js.org;
|
||||||
location ~ ^/(.*) {
|
# location ~ ^/(.*) {
|
||||||
return 302 http://alpha.editor.p5js.org/$1;
|
# return 302 http://alpha.editor.p5js.org/$1;
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
|
|
||||||
# server {
|
# server {
|
||||||
# listen 443;
|
# listen 443;
|
||||||
|
|
|
@ -30,59 +30,59 @@ http {
|
||||||
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
# Load modular configuration files from the /etc/nginx/conf.d directory.
|
||||||
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
# See http://nginx.org/en/docs/ngx_core_module.html#include
|
||||||
# for more information.
|
# for more information.
|
||||||
include /etc/nginx/conf.d/*.conf;
|
# include /etc/nginx/conf.d/*.conf;
|
||||||
|
|
||||||
include /etc/nginx/sites-enabled/*.conf;
|
include /etc/nginx/sites-enabled/*.conf;
|
||||||
|
|
||||||
index index.html index.htm;
|
# index index.html index.htm;
|
||||||
|
|
||||||
server {
|
# server {
|
||||||
listen 80 default_server;
|
# listen 80 default_server;
|
||||||
listen [::]:80 default_server;
|
# listen [::]:80 default_server;
|
||||||
server_name localhost;
|
# server_name localhost;
|
||||||
root /usr/share/nginx/html;
|
# root /usr/share/nginx/html;
|
||||||
|
|
||||||
# Load configuration files for the default server block.
|
# # Load configuration files for the default server block.
|
||||||
include /etc/nginx/default.d/*.conf;
|
# include /etc/nginx/default.d/*.conf;
|
||||||
|
|
||||||
location / {
|
# 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
|
# # redirect server error pages to the static page /40x.html
|
||||||
#
|
# #
|
||||||
#location ~ \.php$ {
|
# error_page 404 /404.html;
|
||||||
# root html;
|
# location = /40x.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
|
# # redirect server error pages to the static page /50x.html
|
||||||
# concurs with nginx's one
|
# #
|
||||||
#
|
# error_page 500 502 503 504 /50x.html;
|
||||||
#location ~ /\.ht {
|
# location = /50x.html {
|
||||||
# deny all;
|
# }
|
||||||
|
|
||||||
|
# # 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.
|
# Settings for a TLS enabled server.
|
||||||
|
|
Loading…
Reference in a new issue