Nginx installation
|
Check the help info after installation:
Start nginx
|
Verify at http://localhost:8080, nginx was started properly if you see the welcome information.
nginx use 8080 port by default, your can change the port number at /usr/local/etc/nginx/nginx.conf.
restart the server after editting the configurations,
Start Nginx at system bootup
|
nginx configuration sample
|
misc
multiple websites settings
following the steps below to host multiple websites at nginx server:
A. create two folders under
/usr/local/etc/nginx/:sites-availableandsites-enabledB. create the file
default.confundersite-available,copy and paste the default server settings fromnginx.conf, and comment the raw content.C. add the following line in
nginx.confinclude /usr/local/etc/nginx/sites-enabled/*;D. create symlinks from
site-availabletosite-enabledln -sfv /usr/local/etc/nginx/sites-available/default.conf /usr/local/etc/nginx/sites-enabled/default.conf
E. restart the nginx service
# restartsudo nginx -s stopsudo nginx`change the default server root
the default root path was located at:
/usr/local/Cellar/nginx/1.2.3/htmlthe
1.2.3will be different according the version of your copy of nginx.You can change the server root path at nginx.conf:
server {listen 80;server_name localhost;#access_log logs/host.access.log main;location / {root html;index index.html index.htm;}