Home > database >  How to read text from another file in nginx.conf file?
How to read text from another file in nginx.conf file?

Time:12-10

I have an nginx config file. I do not want to enter a lot of text with a list of cities and prohibition of access by GeoIp into it, so I decided to put it in a separate file. How can I read from another file in the config file.

the place where I want to read from another file and insert here(nginx.conf):

http {

    access_log  /var/log/nginx/access.log   combined;
    error_log   /var/log/nginx/warn.log     warn;

    server_tokens off;

    upstream thumbor {
        server localhost:8888;
    }

    ...

what I put in a separate file and would like to use in the http block of the config file:

geoip_country /usr/share/GeoIP/GeoIP.dat;
       map $geoip_country_code $allowed_country {
           default no;
        AF no;
        AG no;

        ...
       }

CodePudding user response:

Nginx has an include directive for this configuration pattern.

  • Related