Skip to content

Commit

Permalink
reverse-proxy-for-free-basics (#62): basic MVP, just ngx_pagespeed pr…
Browse files Browse the repository at this point in the history
…oxy to inclusao.etica.ai
  • Loading branch information
fititnt committed Jun 7, 2019
1 parent 1603e11 commit da0eef0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
FROM pagespeed/nginx-pagespeed
COPY nginx.conf /etc/nginx/nginx.conf
COPY ./etc/nginx/nginx.conf /etc/nginx/nginx.conf
#COPY ./etc/nginx/sites-available/nginx.vh.default.conf /etc/nginx/sites-available/default
#COPY ./etc/nginx/sites-available/etica.ai.conf /etc/nginx/sites-available/default
COPY ./etc/nginx/sites-available/inclusao.etica.ai.conf /etc/nginx/conf.d/inclusao.etica.ai.conf
29 changes: 29 additions & 0 deletions etc/nginx/sites-available/inclusao.etica.ai.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
server {
listen 80;
server_name rp4fb.*;

location / {
access_log off;
# inclusao.etica.ai is hosted at GitHub pages, but is behind
# cloudflare (that could complain about this crawler)
proxy_pass http://fititnt.github.io:80;
proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header Host $host;
proxy_set_header Host 'inclusao.etica.ai';
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

pagespeed on;

# Needs to exist and be writable by nginx. Use tmpfs for best performance.
pagespeed FileCachePath /var/cache/ngx_pagespeed;

# Ensure requests for pagespeed optimized resources go to the pagespeed handler
# and no extraneous headers get set.
location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
add_header "" "";
}
location ~ "^/pagespeed_static/" { }
location ~ "^/ngx_pagespeed_beacon$" { }

}
16 changes: 13 additions & 3 deletions help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,18 @@ docker build -t reverse-proxy-for-free-basics .
docker run --name proxy-inclusao-etica-ai -p 8080:80 -d reverse-proxy-for-free-basics

# Parar o conteiner e apagar
docker stop proxy-inclusao-etica-ai
docker rm proxy-inclusao-etica-ai
docker rm -f proxy-inclusao-etica-ai

# Apagar imagem do conteiner (use para rebuildar)
docker rmi proxy-inclusao-etica-ai
docker rmi proxy-inclusao-etica-ai

# Apenas para testar inclusao.etica.ai com um subdominio fake
# Com isso eu posso acessar http://rp4fb.inclusao.etica.ai ou http://rp4fb.inclusao.etica.ai:8080/
# e tentará acessar https://inclusao.etica.ai
# sudo vim /etc/hosts
127.0.0.1 rp4fb.inclusao.etica.ai

# Full drill
docker rm -f proxy-inclusao-etica-ai && \
docker build -t reverse-proxy-for-free-basics . && \
docker run --name proxy-inclusao-etica-ai -p 8080:80 reverse-proxy-for-free-basics

0 comments on commit da0eef0

Please sign in to comment.