match index in URI
This commit is contained in:
parent
ed04838f0d
commit
d1b392d2a2
@ -1,6 +1,12 @@
|
||||
autoindex on
|
||||
error_page 400 ./htdocs/error_pages/400.html
|
||||
error_page 500 ./htdocs/error_pages/500.html
|
||||
error_page 400 ./htdocs/error_pages/400.html;
|
||||
error_page 404 ./htdocs/error_pages/404.html;
|
||||
error_page 404 ./htdocs/error_pages/404.html;
|
||||
error_page 403 ./htdocs/error_pages/403.html;
|
||||
error_page 405 ./htdocs/error_pages/405.html;
|
||||
error_page 413 ./htdocs/error_pages/413.html;
|
||||
error_page 500 ./htdocs/error_pages/500.html;
|
||||
error_page 502 ./htdocs/error_pages/502.html;
|
||||
error_page 504 ./htdocs/error_pages/504.html;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
@ -61,15 +67,6 @@ server {
|
||||
root ./htdocs/site-2/;
|
||||
index index.html index2.htm;
|
||||
|
||||
error_page 400;
|
||||
error_page 403 /403.html;
|
||||
error_page 404 /404.html;
|
||||
error_page 405 /405.html;
|
||||
error_page 413 /413.html;
|
||||
error_page 500 /500.html;
|
||||
error_page 502 /502.html;
|
||||
error_page 504 /504.html;
|
||||
|
||||
client_max_body_size 1M;
|
||||
|
||||
location / {
|
||||
@ -104,15 +101,6 @@ server {
|
||||
root ./htdocs/site-3/;
|
||||
index index.html index2.htm;
|
||||
|
||||
error_page 400;
|
||||
error_page 403 /403.html;
|
||||
error_page 404 /404.html;
|
||||
error_page 405 /405.html;
|
||||
error_page 413 /413.html;
|
||||
error_page 500 /500.html;
|
||||
error_page 502 /502.html;
|
||||
error_page 504 /504.html;
|
||||
|
||||
client_max_body_size 1M;
|
||||
|
||||
location / {
|
||||
|
||||
@ -110,6 +110,20 @@ void URI::parseFullpath()
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (baseName_.empty() && FileUtils::isDirectory(fullPath_))
|
||||
{
|
||||
for (const auto &index : config_->get<std::vector<std::string>>("index").value_or(std::vector<std::string>()))
|
||||
{
|
||||
std::string indexPath = FileUtils::joinPath(fullPath_, index);
|
||||
if (FileUtils::isFile(indexPath))
|
||||
{
|
||||
baseName_ = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Log::debug("URI parseFullpath results",
|
||||
{{"dir", dir_}, {"baseName", baseName_}, {"pathInfo", pathInfo_}});
|
||||
fullPath_ = FileUtils::joinPath(dir_, baseName_);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user