Skip to content

Instantly share code, notes, and snippets.

@donvitonet
Created March 25, 2013 19:55
Show Gist options
  • Save donvitonet/5240117 to your computer and use it in GitHub Desktop.
Save donvitonet/5240117 to your computer and use it in GitHub Desktop.
- Criando uma instância AWS EC2
- Sistema Operacional Amazon Linux AMI 2012.09.01 64bit
- Tipo t1.micro
- Zona : sa-east-1a
- Tags
- Name : seuNomeInstalacao
- Grupo de Segurança : seuGrupoSeguranca
- Portas abertas : 22(SSH), 80(HTTP), 3306(MYSQL)
- Chave de acesso :
E:\Reginaldo\Programas\suaChave.pem
Em ambiente Windows utilizamos PuTTy, para acessar a instância, para mais informações acesse http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
- Utilize PuTTYGen, para gerar uma chave com a extensão (.ppk)
- Execute o putty.exe
- Em Category, selecione Connection > SSH > Auth
- No campo Private key file for authentication, click em Browse e selecione a chave suaChave.ppk
- Depois click em Session
- Em Host Name ( or IP address ), digite ec2-user@seuDnsPublico
- Em Saved Sessions, digite seuNomeEC2
- Salve
- Para acessar
- Carregue as configurações de Socioton, no primeiro acesso irar aparecer alerta PuTTy Secutity Alert, click em sim.
- Sera exibido um terminal, onde iremos executar os comandos para configurar a instância.
- Intalações
- Servidor Web
- yum install nginx
- chkconfig nginx on (Caso a Instância EC2 seja reiniciada, o NGINX será iniciado junto com sistema operacional)
- service nginx start
- PHP
- yum install php
- yum install php-pdo
- yum install php-mysql
- yum install php-fpm
- Editar php.ini
- vi /etc/php.ini
- buscar por /cgi.fix_pathinfo
- descomentar cgi.fix_pathinfo e setar seu valor para 0 ficando assim : cgi.fix_pathinfo=0
- Setar timezone : date.timezone = "America/Sao_Paulo"
/etc/init.d/php-fpm start
- GIT
- yum install git
- cd /var/opt/app/webcal/app/Plugin
- CakePHP
- cd /var/opt/
- wget https://github.com/cakephp/cakephp/zipball/2.3.1 [Executar este comando dentro do diretório onde CakePHP sera instalado]
- unzip 2.3.1
- mv cakephp-cakephp-af0dfb5/ devsocioton
- rm -f 2.3.1
- Caminho da aplicação : /var/opt/devsocioton
- Permissão de escrita : chmod 777 -R /app/tmp/
- Ulizando Composer
- cd /app/Plugin
- git clone git://github.com/uzyn/cakephp-composer.git Composer
- cd app
- Adicionar em Config/bootstrap.php, CakePlugin::loadAll(); para carregar todos os plugins utilizados na aplicação.
- Configuração do Servidor Web
- Editar virtual.conf : vi /etc/nginx/conf.d/virtual.conf
server {
listen 80;
server_name www.ec2-54-232-20-136.sa-east-1.compute.amazonaws.com;
rewrite ^(.*) http://ec2-54-232-20-136.sa-east-1.compute.amazonaws.com$1 permanent;
}
server {
listen 80;
server_name ec2-54-232-20-136.sa-east-1.compute.amazonaws.com;
root /var/opt/devsocioton/app/webroot/;
index index.php index.html index.htm;
access_log /var/log/nginx/access_devsocioton.log;
error_log /var/log/nginx/error_devsocioton.log;
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6].(?!.*SV1)";
location ~ \.php$ {
try_files $uri = 404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
- Por causa do server_name muito grande foi necessário editar
- vi /etc/nginx/nginx.conf
- adicionar dentro de http : server_names_hash_bucket_size 128;
- Reiniciar Nginx : /etc/init.d/nginx restart
- Criando uma Instância AWS RDS
- Selecionar o BD MYSQL
- Tipo db.t1.micro
- Zona : sa-east-1a
- DB Instance Identifier : seuNomeInstancia
- Master Username : seuUser
- Master Password : suaSenha
- Database Name : seuNomeDataBase
- EndPoint : url
- Adicionar a instância no mesmo Security Groups da instância EC2
@samuelrs
Copy link

oi donvitonet,
Estou tendo um problema e configurar o nginx para cakephp no ubuntu. Em minha maquina local mesmo.
O problema esta no arquivo de configuração do nginx que nao consigo configurar de forma alguma.
voce poderia me dar uma "luz"? hehe

@samuelrs
Copy link

eu tenho uma pergunta mais detalhada no forum do nginx:

http://forum.nginx.org/read.php?11,241413

Se voce puder dar uma olhada. Ou caso prefira posso passar meu email para podermos trocar informações.
obrigado

@itbj
Copy link

itbj commented Jan 26, 2014

cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment