![将 NGINX 动态地插入到每个服务器指令文件中](https://linux22.com/image/729857/%E5%B0%86%20NGINX%20%E5%8A%A8%E6%80%81%E5%9C%B0%E6%8F%92%E5%85%A5%E5%88%B0%E6%AF%8F%E4%B8%AA%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%8C%87%E4%BB%A4%E6%96%87%E4%BB%B6%E4%B8%AD.png)
我当前的设置是:
我的 nginxhttp
设置如下..
http{
# ...
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/.conf*;
}
conf
并且我有的每个服务器文件包括:
server{
# top settings..
include common.conf;
include wordpress.conf;
# etc ..
}
因此,我想要使用并拥有的是如下内容:
http{
# ...
for each server in (/etc/nginx/sites-enabled/*.conf){
include common.conf;
include wordpress.conf;
}
}
我想定义它common.conf
并wp
设置自动包含在每个服务器中,在http
块中定义它,而不是将其包含在每个server
块中。
谢谢你的帮助