• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question Plesk XML API to change nginx directives

chapterjason

New Pleskian
Hey,

I currently working on a PAAS for NodeJS and PHP Applications that run in Docker.

Currently im stuck a bit while try to create the proxy_pass in nginx, I already modified my vhost template that the proxy_pass in the Additional directives will take place.

But I don't know how to set this via the XML API.
 
Perhaps this link can be of use:

  • The additional-nginx node is optional. It specifies additional directives for nginx. Data type: string.
 
@Rasp Thanks for your reply.

Your link shows a way to add this for all domains on the server. What i would like is to use it on a per domain basis.

I'm using the php api client library to do a request like:
PHP:
$this->client->request([
            'site' => [
                [
                    'set' => [
                        'filter'  => [
                            'name' => 'my-domain.com'
                        ],
                        'values' => [
                            'hosting' => [
                                'vrt_hst' => [
                                    'property' => [
                                        [
                                            'name' => 'additional-nginx',
                                            'value' => 'my-value'
                                        ]
                                    ]
                                ]
                            ]
                        ]
                    ]
                ]
            ]
        ])

I have tried both additional-nginx-settings and additional-nginx. It returns a "status": "ok" but when i go to plesk and look at the "Additional nginx directives" under the domain the field is empty. Also doing a quick cat /var/www/vhosts/system/my-domain.com/conf/vhost_nginx.conf shows an empty file.

Is this possible through the API?
 
Hmmm, I could not find anything related in the API documentation. Neither does the Plesk CLI seem to have a similar feature. Not 100% sure, but I am afraid it isn't possible.

I did found this article however. Which looks interesting as workaround.
 
Back
Top