eighteen73/nginx-proxy-manager-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

eighteen73/nginx-proxy-manager-api

最新稳定版本:v2.0.0

Composer 安装命令:

composer require eighteen73/nginx-proxy-manager-api

包简介

PHP Library for controlling NginxProxyManager https://github.com/NginxProxyManager

README 文档

README

PHP Library for NginxProxyManager API.

Requirements

  • PHP 8.0+
  • guzzlehttp/guzzle 7.4+
  • ext-json extension

Installation

composer require eighteen73/nginx-proxy-manager-api

Otherwise just download the package and add it to the autoloader.

Usage

Retrieve an API Token.

$accessToken = Eighteen73\NginxProxyManager\NginxProxyManager::createAccessToken($baseUrl, $username, $password);

Create a new VHost

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->create([
    'access_list_id' => '0', // ID of an Access List to restrict host
    'advanced_config' => '', // Advanced Nginx rules
    'allow_websocket_upgrade' => false
    'block_exploits' => true,
    'caching_enabled' => false,
    'certificate_id' => "new", // Either ID of existing cert, or "new" to request a new cert
    'domain_names' => ['example.com'], // Array of domains
    'forward_host' => '127.0.0.1', // Backend server hostname or IP
    'forward_port' => 8080, // Backend server port
    'forward_scheme' => 'http', // Backend listen scheme/protocol
    'hsts_enabled' => true,
    'hsts_subdomains' => false,
    'http2_support' => true,
    'ssl_forced' => true,
    'locations' => [], // Custom location directives for Nginx
    'meta' => [
        'letsencrypt_agree': false,
        'dns_challenge': false,
    ],
]);

Update an existing record

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->update($id, [
    // As create method above
]);

Delete a host

$nginx = Eighteen73\NginxProxyManager\NginxProxyManager::create($baseUrl, $accessToken);
$nginx->hosts()->delete($id);

Links

统计信息

  • 总下载量: 2.88k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 5
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-01-17