Skip to content

Instantly share code, notes, and snippets.

@mgmerino
Created February 8, 2018 16:58
Show Gist options
  • Save mgmerino/fc63dfb1b397e11ee4ecaaea612b70a8 to your computer and use it in GitHub Desktop.
Save mgmerino/fc63dfb1b397e11ee4ecaaea612b70a8 to your computer and use it in GitHub Desktop.
Quick & dirty local env for development on macOS

Simple local dev env

Prerequisites

brew install --without-apache --with-fpm --with-mysql php71

brew install nginx

nginx sample configuration

server {
  listen 8080;
  server_name ~^(?<proj>[^.]+).devsites.local;
  root /Users/{username}/www/$proj;
  index index.html index.php;

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

  location ~ \.php$ {
        try_files      $uri /index.html index.php;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
  }
}

/etc/hosts

Assuming {projectName} as the folder name.

127.0.0.1 {projectName}.devsites.local

Further reading:

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