Skip to content

Commit

Permalink
aguia-pescadora-bravo (#16), php (#7), php-web (#41): MVP de exibir c…
Browse files Browse the repository at this point in the history
…onteudo gerado por PHP via HTTP/HTTPS
  • Loading branch information
fititnt committed May 24, 2019
1 parent d160a1b commit 80182ba
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 71 deletions.
16 changes: 11 additions & 5 deletions logbook/aguia-pescadora-bravo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,11 @@ sudo usermod -a -G www-data loopchaves
sudo -u loopchaves mkdir /home2/loopchaves/web
sudo -u loopchaves mkdir /home2/loopchaves/web/public_html
sudo -u loopchaves mkdir /home2/loopchaves/web/public_api
sudo -u loopchaves mkdir /home2/loopchaves/web/php

sudo -u loopchaves echo "loopchaves <br>Servidor comunitario: http://aguia-pescadora-bravo.etica.ai <br>Arquivo: /home2/loopchaves/web/public_html/index.html" > /home2/loopchaves/web/public_html/index.html
sudo -u loopchaves echo "loopchaves <br>Servidor comunitario: http://aguia-pescadora-bravo.etica.ai <br>Arquivo: /home2/loopchaves/web/php/index.php <br><?php phpinfo(); ?>" > /home2/loopchaves/web/php/index.php


sudo cp /etc/nginx/sites-available/EXEMPLO-USUARIO.abp.etica.ai.conf /etc/nginx/sites-available/loopchaves.apb.etica.ai.conf

Expand All @@ -429,6 +432,7 @@ sudo nginx -t
sudo systemctl reload nginx

sudo certbot --nginx -d loopchaves.apb.etica.ai
sudo certbot --nginx -d php.loopchaves.apb.etica.ai

sudo chown loopchaves:loopchaves -R /home2/loopchaves

Expand All @@ -447,12 +451,13 @@ sudo chmod 751 /home2/usuariodeteste

# Em Home2, prepara diretórios comuns para sair usando apps web

sudo mkdir /home2/usuariodeteste/web
sudo mkdir /home2/usuariodeteste/web/public_html
sudo mkdir /home2/usuariodeteste/web/public_api
sudo -u usuariodeteste mkdir /home2/usuariodeteste/web
sudo -u usuariodeteste mkdir /home2/usuariodeteste/web/public_html
sudo -u usuariodeteste mkdir /home2/usuariodeteste/web/public_api
sudo -u usuariodeteste mkdir /home2/usuariodeteste/web/php

sudo echo "usuariodeteste <br>Servidor comunitario: http://aguia-pescadora-bravo.etica.ai <br>Arquivo: /home2/usuariodeteste/web/public_html/index.html" > /home2/usuariodeteste/web/public_html/index.html
sudo chown usuariodeteste:usuariodeteste /home2/usuariodeteste/web/public_html/index.html
sudo -u usuariodeteste echo "usuariodeteste <br>Servidor comunitario: http://aguia-pescadora-bravo.etica.ai <br>Arquivo: /home2/usuariodeteste/web/public_html/index.html" > /home2/usuariodeteste/web/public_html/index.html
sudo -u usuariodeteste echo "usuariodeteste <br>Servidor comunitario: http://aguia-pescadora-bravo.etica.ai <br>Arquivo: /home2/usuariodeteste/web/php/index.php <br><?php phpinfo(); ?>" > /home2/usuariodeteste/web/php/index.php

sudo vim /etc/nginx/sites-available/usuariodeteste.apb.etica.ai.conf
# Adicione todas as customizacoes deste usuario no arquivo acima...
Expand Down Expand Up @@ -482,6 +487,7 @@ curl http://python.usuariodeteste.lb-ap.etica.ai
# Linha de comando para obter certificados. Automaticamente já edita configurações do NGinx
# Nota: o subdominio de lb-ap via HTTPS ainda não sera adicionado, veja https://github.com/fititnt/cplp-aiops/issues/35#issuecomment-495508373
sudo certbot --nginx -d usuariodeteste.apb.etica.ai
sudo certbot --nginx -d php.usuariodeteste.apb.etica.ai

#------------------------------------------------------------------------------#
# SEÇÃO 1.1: USUÁRIOS DO SISTEMA - MENSAGENS INFORMATIVAS #
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,26 @@ server {

### OPÇÕES PARA DEBUG EXCLUSIVAMENTE NESTE DOMINIO, INICIO
# Autoindex não é algo recomendado. Porém fititnt está debugando
autoindex on;
#autoindex on;
# Desliguei isso no final. Este modo de debug é MUITO detalhado. Pode lotar o disco!
error_log /var/log/nginx/error-fititnt.log debug;
#error_log /var/log/nginx/error-fititnt.log debug;

# Use isto por terminal:
# tail -f /var/log/nginx/error-fititnt.log
### OPÇÕES PARA DEBUG EXCLUSIVAMENTE NESTE DOMINIO, INICIO

location / {
try_files $uri $uri/ /index.php?$query_string;
try_files $uri $uri/ =404;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}


listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/php.fititnt.apb.etica.ai/fullchain.pem; # managed by Certbot
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,38 @@ server {
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

# PHP
server {

listen 80;
listen [::]:80;
root /home2/loopchaves/web/php;

index index.html index.htm index.php;

server_name php.loopchaves.apb.etica.ai php.loopchaves.lb-ap.etica.ai;

location / {
try_files $uri $uri/ =404;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}



listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/php.loopchaves.apb.etica.ai/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/php.loopchaves.apb.etica.ai/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,38 @@ server {
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

# PHP
server {

listen 80;
listen [::]:80;
root /home2/usuariodeteste/web/php;

index index.html index.htm index.php;

server_name php.usuariodeteste.apb.etica.ai php.usuariodeteste.lb-ap.etica.ai;

location / {
try_files $uri $uri/ =404;
}

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}



listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/php.usuariodeteste.apb.etica.ai/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/php.usuariodeteste.apb.etica.ai/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

0 comments on commit 80182ba

Please sign in to comment.