Nginx and Virtual Host in Mac Sierra



After installing nginx using brew you can follow the steps : Localtion :
/usr/local/etc/nginx
nginx.conf
#user  nobody;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log /usr/local/var/log/nginx/access.log;
    error_log /usr/local/var/log/nginx/error.log;

    sendfile        on;
    keepalive_timeout  65;

    gzip  on;


    include /usr/local/etc/nginx/sites-enabled/*;

}

Location :
 
/usr/local/etc/nginx/sites-enabled
default
server {
	listen       8080;
	server_name  localhost;
	root /Users/sr/Sites/; 

	index index.html index.htm;

	#try_files $uri $uri/ /index.php?$args;

	#location ~ \.php$ {
		#fastcgi_pass   127.0.0.1:9000;
		#fastcgi_index  index.php;
		#fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
		#include        fastcgi_params;
	#}

}
zogo-commerce.dev
server {
	listen       8080;
	server_name  zogo-commerce.dev;

	root /Users/sr/Sites/zogo-commerce/public; 

	index index.php index.html index.htm;

	try_files $uri $uri/ /index.php?$args;

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

}

Selim Reza

Site Footer