0

What I have currently :

server {
    
    listen 80;
    server_name www.lala.com lala.com;
    
    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass       http://127.0.0.1:81;
    }
}

I want to add (not replace) a new value to the server_name directive. What I tried to do using augtool:

augtool> set /files/etc/nginx/conf.d/site.conf/server[1]/*[self::directive="server_name"]/arg[last() + 1] "www.lala2.com lala2.com"
error: Failed to execute command
Setting /files/etc/nginx/conf.d/site.conf/server[1]/*[self::directive="server_name"]/arg[last() + 1] failed
augtool>

Using :

augtool> print /augeas//error

Did not gave me any clue about the error. Could someone please help me with this ?

1 Answers1

0

The server_name field is currently not parsed by Augeas, so it results in a single string, not an array.

As a result, you need to replace the whole thing.

raphink
  • 11,987
  • 6
  • 37
  • 48