setup vhost with nginx on mamp free version setup vhost with nginx on mamp free version nginx nginx

setup vhost with nginx on mamp free version


  1. In the MAMP/conf/nginx directory, I created a sites-enabled folder for configs for individual sites.

  2. I added a config file for the site example.com in MAMP/conf/nginx/sites-enabled

  3. I added config vars to MAMP/conf/nginx/sites-enabled/example.com:

     server {     charset utf-8;     client_max_body_size 128M;     sendfile off;     listen 80;     server_name example.com;     root        /Applications/MAMP/htdocs/example.com/;     index       index.php;     location / {         # Redirect everything that isn't a real file to index.php         try_files $uri $uri/ /index.php$is_args$args;     }     location ~ \.php$ {         try_files        $uri =404;         fastcgi_pass              unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;         fastcgi_param    SCRIPT_FILENAME          $document_root$fastcgi_script_name;         include          fastcgi_params;     } }
  4. At the end of the config main file (MAMP/conf/nginx/nginx.conf), I connect all the configs from the sites-enabled folder:

        include sites-enabled/*; }
  5. Restart MAMP