Setup on Mac with MacPorts
$ sudo apt-get install
On OS X (macports):
$ port install nginx
To run at system start:
$ sudo port load nginx
Config files and folders
- /etc/nginx/
On OS X (macport):
- /opt/local/etc/nginx/
Activate default configuration
Start by setting the default config files:
$ cd /opt/local/etc/nginx
$ sudo cp nginx.conf.default nginx.conf
$ sudo cp mime.types.default mime.types
Load http://localhost in your browser to see that it's working.
Reload
$ sudo nginx -s stop; sudo nginx
or, if you just need updating config
$ sudo nginx -s reload
OS X uses launchd so the process of starting/stopping daemons is slightly different.
$ sudo port unload nginx
$ sudo port load nginx
Make Browsers Cache Static Files On nginx
location /static {
alias {{django.static_root}};
# Make Browsers Cache Static Files On nginx
# See: http://www.howtoforge.com/make-browsers-cache-static-files-on-nginx
# and http://serverfault.com/questions/370525/nginxdjango-serving-static-files
access_log off;
expires modified 1m;
}