How to use conf file name from confin file?

If I have a file with a name mysite.confthat is stored in /etc/nginx/conf.d. Is there a way to get a string value 'mysite'from a conf file?

I want to symbolize a common .conf file several times, because they are all identical, except for one small line. As a quick example, instead:

server {
    #
    # snip
    #

    access_log /var/log/nginx/mysite_access.log;
    error_log /var/log/nginx/mysite_error.log;

    #
    # snip
    #
}

I want to do this:

server {
    #
    # snip
    #

    access_log /var/log/nginx/$filename_access.log;
    error_log /var/log/nginx/$filename_error.log;

    #
    # snip
    #
}

I want to name the file mysite.conf, and I want symlink to have 5 more of them:

/etc/nginx/conf.d/mynextsite.conf
/etc/nginx/conf.d/myothersite.conf
etc

, conf . , uwsgi %n. . . nginx conf?

+4
1

. :

server {
    listen 80;
    sever_name example.com example.org domain.net;

    error_log /var/log/nginx/${host}_error.log;
    access_log /var/log/nginx/${host}_access.log;

    ....
}

, /var/log/nginx/example.org_access.log /var/log/nginx/domain.net_access.log.

0

Source: https://habr.com/ru/post/1616463/


All Articles