I have worked with Apache before, so I am aware that the default public web root is typically /var/www/
.
I recently started working with nginx, but I ca
On Mac install nginx with brew:
/usr/local/etc/nginx/nginx.conf
location / {
root html; # **means /usr/local/Cellar/nginx/1.8.0/html and it soft linked to /usr/local/var/www**
index index.html;
}
If you need to find out nginx public root folder that was defined at compile time you can just check your access.log file.
Here is an example from the http section of nginx.conf with modified log_format directive, $document_root is added at the beginning of the string:
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
## ADD $document_root HERE ##
log_format main '$document_root $remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
etc. .......
Then backup all configuration files *.conf in conf.d directory and create there configuration file, test.conf with the following lines:
server{
listen 80;
server_name localhost;
}
Add following line to /etc/hosts file: 127.0.0.1 localhost
Reload nginx configuration: nginx -s reload
Send GET request to http://localhost: curl http://localhost
Check the last string of access.log:tail -n 1 /var/log/nginx/access.log
Here is the sample output of this command, where /etc/nginx/html is the default document root defined at compile time :
/etc/nginx/html 127.0.0.1 - - [15/Mar/2017:17:12:25 +0200] "GET / HTTP/1.1" 404 169 "-" "curl/7.35.0" "-"
If installing on Ubuntu using apt-get, try /usr/share/nginx/www
.
EDIT:
On more recent versions the path has changed to:
/usr/share/nginx/html
2019 EDIT:
Might try in /var/www/html/index.nginx-debian.html
too.
If you are on Ubuntu 14.04 you can find nginx www directory at following path:
yusuf@yusuf-he:/usr/share/nginx/html$ pwd
/usr/share/nginx/html
yusuf@yusuf-he:/usr/share/nginx/html$
For nginx/1.4.6 (Ubuntu)
/etc/nginx$ cat /etc/nginx/sites-available/default | grep -i root
- root /usr/share/nginx/html;
You can find it in /var/www/ that is default directory for nginx and apache but you can change it. step 1 go to the following folder /etc/nginx/sites-available
step 2 edit default file in that you can find a server block under that there will be line named as root that is what defines the location.