【发布时间】:2019-01-01 04:07:17
【问题描述】:
我想将不同的配置文件添加到不同的目录。例如:
root /var/www/root/html
location / {
root /var/www/root/html
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
include a.conf
include phphandler.conf
}
location /dir1/ {
root /var/www/dir1/html
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
include b.conf
}
location /dir2/ {
root /var/www/dir2/html
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
include c.conf
include phphandler.conf
}
所以每个目录都有自己的 .conf 文件(egaconf、b.conf),其中包含自己的 php 处理选项、错误处理选项等,并且有一个通用的 conf 文件(phphandler.conf),其中包含适用于所有子目录。
这行得通吗?我想为每个子目录分离错误页面和配置文件。
另外,更新 nginx 是否会将 /site-available/default 恢复为默认配置?
【问题讨论】:
-
成功了吗?我建议您尝试一下并分享有关哪些问题的详细信息,以便人们帮助排除故障。
标签: php nginx configuration subdirectory