I just installed nginx
using brew
and its default config is located at /usr/local/etc/nginx
. The server configuration in default conf
file is as below (only small portion pasted)
server {
listen 8080;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
...
}
The location from which the index.html
is being served is /usr/local/var/www/
. Now, looking at the above configuration, I don’t understand how nginx
goes to /usr/local/var/www/
to look for default file? Is there a different configuration that directs nginx
to look into that folder?
2
Answers
Setting it like this
root html
makes nginx use relative location.The easiest way is to have the root written with the full desired path like this
root /var/www/html;
--prefix
is set to the Homebrew prefix:/usr/local
on Intel.html
→/usr/local/html
(the nginx prefix + the relative path).#{HOMEBREW_PREFIX}/var/www
, that is, to/usr/local/var/www
: