Skip to content

Instantly share code, notes, and snippets.

@iagodahlem
Last active August 29, 2015 14:25
Show Gist options
  • Save iagodahlem/ca85ce7f141e449daa24 to your computer and use it in GitHub Desktop.
Save iagodahlem/ca85ce7f141e449daa24 to your computer and use it in GitHub Desktop.
Iniciando um novo projeto com uma URL interna no Nginx.
1.Configurando Virtual Host (URL Interna)
Aplicar Entrada
cd /etc/
sudo subl hosts
Aplicar nova entrada
127.0.0.1 CHANGEME.app
2.Adicionar Caminho ao Nginx
cd etc/nginx
cd sites-available/
sudo subl CHANGEME.app.conf
Adicionar ao Arquivo:
server {
listen 80;
server_name CHANGEME.app;
root /var/www/vhosts/CHANGEME.app/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/CHANGEME.app-error.log error;
error_page 404 /index.php;
sendfile off;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
}
location ~ /\.ht {
deny all;
}
}
3.Criar Direório
sudo mkdir -p /var/www/vhosts/CHANGEME.app/public
sudo subl /var/www/vhosts/CHANGEME.app/public/index.php
<?php phpinfo(); ?>
cd etc/nginx/sites-enabled
ln -s ../site-available/CHANGEME.app.conf
sudo service nginx restart
sudo service php5-fpm restart
5.Mudando permissões da pasta do projeto CHANGEME.app
cd ~/vhosts/
sudo chown -R iago:www-data CHANGEME.app/
sudo chmod -R 771 CHANGEME.app/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment