Created
February 27, 2013 17:07
-
-
Save fredericoramos/5049609 to your computer and use it in GitHub Desktop.
Ubuntu - NGINX - Install and Config - Many Domains - PHP - PHPmyAdmin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
========================================================== | |
========================================================== | |
Instalando e Configurando o NGINX | |
========================================================== | |
========================================================== | |
sudo aptitude install nginx | |
############################################### | |
# | |
# Caso precise remover o nginx | |
# Case you need remove the nginx | |
# | |
# apt-get purge nginx nginx-common nginx-full | |
# | |
################################################ | |
# Criando Diretório | |
# Make Directory | |
# mkdir -p /path/domain1.com.br/{html,log,backup} | |
mkdir -p /mnt/projects/domain1.com/{html,log,backup} | |
# Diretório onde seu VHOSTs serão definidos | |
# VHosts directories places | |
# /etc/nginx/sites-available | |
# | |
# Para habilitar a configuração deve-se crar um link simbólico no diretório | |
# You must create simbolic link in the directory | |
# /etc/nginx/sites-enabled | |
# | |
# Criar um arquivo chamado MEUDOMINIO.COM.BR com o conteúdo: | |
# Make a file called MYDOMAIN.COM.BR | |
# | |
sudo vim etc/nginx/sites-available/mydomain.com.br | |
server { | |
listen 80; | |
server_name mydomain.com.br; | |
# Configurar diretório de erro e acesso | |
# Configure error and access directory | |
access_log /mnt/projects/mydomain.com.br/log/access.log; | |
error_log /mnt/projects/mydomain.com.br/log/error.log; | |
root /mnt/projects/mydomain.com.br/html/; | |
index index.php index.html index.htm; | |
location / { | |
try_files $uri $uri/ /index.html; | |
} | |
location /doc/ { | |
alias /usr/share/doc/; | |
autoindex on; | |
allow 127.0.0.1; | |
allow ::1; | |
deny all; | |
} | |
# Configurar para ler aquivo PHP | |
# Configure to use PHP | |
location ~ \.php$ { | |
# fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
# fastcgi_pass 127.0.0.1:9000; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
# Configurar o PHPmyAdmin | |
# Configure to use PHPmyAdmin | |
location /phpmyadmin { | |
root /usr/share/; | |
index index.php index.html index.htm; | |
location ~ ^/phpmyadmin/(.+\.php)$ { | |
try_files $uri =404; | |
root /usr/share/; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} | |
# Se vc quiser desabilitar Cache (expires) para determinados tipos de arquivos | |
# If you want to disable Cache (expires) for some type of files | |
# expires 10d = > apaga o cache em 10 dias / erase after 10 days | |
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { | |
expires -1; | |
log_not_found off; | |
} | |
} | |
# Para habilitar a configuração deve-se criar um link simbólico no diretório | |
# To enable the configuration you must create a symbolic link | |
# /etc/nginx/sites-enabled | |
ln -s /etc/nginx/sites-available/mydomain.com.br /etc/nginx/sites-enabled/mydomain.com.br | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment