• Plesk Uservoice will be deprecated by October. Moving forward, all product feature requests and improvement suggestions will be managed through our new platform Plesk Productboard.
    To continue sharing your ideas and feedback, please visit features.plesk.com

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