For example, I have a webserver for testing.
Now I put Drupal 8 in a Subdirectory.
The server config in Nginx is OK for plain php files, but Drupal needs another config because of URL scheme.
My goal is something like this:
normal.cfg
server {
listen 80;
server_name _;
location (phpfiles) {
pass to PHPFPM;
}
}
drupal_test.cfg
server {
listen 80;
server_name _;
location /drupal/(phpfiles) {
do_some_magic
pass to PHPFPM;
}
}
But then Nginx complains about ignoring duplicated server_name
.
So, how can I include a specific (separated file) configuration for a given subdirectory of a given server_name
that I can later delete without much problems? This is because I don't want to mess up the main config.
the probably most common way of doing this is to include a separate file for every virtual server. you can either include a specific file with
include /path/of/configfile;
or choose the common way by using a wildcard:
include /etc/nginx/sites-enabled/*;
in both cases you have to put this line in the http direcitve of your nginx config file.