Skip to content

Instantly share code, notes, and snippets.

@pablocampina
Created April 15, 2016 19:28
Show Gist options
  • Save pablocampina/ab6706e628d62347e8d0b64f24963f49 to your computer and use it in GitHub Desktop.
Save pablocampina/ab6706e628d62347e8d0b64f24963f49 to your computer and use it in GitHub Desktop.
SETUP VIRTUAL HOSTS
atom /usr/local/etc/nginx/sites-available/mydomain.dev
CONFIG EXAMPLE
server {
listen *:80;
server_name mydomain.dev;
access_log /usr/local/etc/nginx/logs/mydomain.access.log;
error_log /usr/local/etc/nginx/logs/mydomain.error.log;
location / {
root /var/www/mydomain.dev;
try_files $uri $uri/ /index.php?$args;
index index.php;
}
location ~ \.php$ {
root /var/www/mydomain.dev;
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
CREATE SYMLINK TO SITES-ENABLED
sudo ln -s /usr/local/etc/nginx/sites-available/mydomain.dev /usr/local/etc/nginx/sites-enabled/mydomain.dev
UPDATE HOSTS atom /etc/hosts:
127.0.0.1 mydomain.dev
::1 mydomain.dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment