setup vhost with nginx on mamp free version
In the MAMP/conf/nginx directory, I created a
sites-enabled
folder for configs for individual sites.I added a config file for the site
example.com
inMAMP/conf/nginx/sites-enabled
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; } }
At the end of the config main file
(MAMP/conf/nginx/nginx.conf)
, I connect all the configs from thesites-enabled
folder:include sites-enabled/*; }
Restart MAMP