Answer the question
In order to leave comments, you need to log in
How to setup root in nginx in my case?
Half the night I unsuccessfully tried to google the reason why this configuration does not work for me (the server returns 404 when requesting /):
...
root /home/max/www/project;
location / {
root /pages;
index index.html;
}
...
Answer the question
In order to leave comments, you need to log in
By specifying root in a location, you override it within the location, at the server level, and in other locations (if there are no overrides in them), root will remain the same. What do you not like?
root /home/max/www/project;
location / {
root /home/max/www/project/pages;
# [...]
}
# можешь хоть для каждого location переопределить root,
# но нет нужды в этом в твоём случае - достаточно переопределить root
# только для location / { ... }
root /pages;
- means to look for files in the pages directory, which is located in the root of the disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question