Coder Social home page Coder Social logo

leksandre / confignginxbysocketpublic Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19 KB

создание конфигов для нжинкса в автоматичском режиме, демон висит на порту и принимает запросы на создание конфигов

Python 64.59% PHP 35.41%

confignginxbysocketpublic's Introduction

configNginxBySocketPublic

php like

    // $postUrl = gethostbyname($_SERVER['SERVER_NAME']);
    // $postUrl = "127.0.0.1";
    $postUrl = str_ireplace('https://tenant.', 'docker.', Yii::app()->params['currentServerParams']['url']);
    // $postUrl = "docker.mobsted.ru";
    // dd($postUrl);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $postUrl);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10000);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    // curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
    curl_setopt($ch, CURLOPT_PORT, 9090);
    // curl_setopt($ch, CURLOPT_HEADER, 1);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_POST, 1);

    $additional = '';
    if ($isCustom==0){
        $additional = (Yii::app()->params['client_portal'] ?? '') . '.';
    }

    curl_setopt(
        $ch, CURLOPT_POSTFIELDS, "process_config_" . $additional . $url);
    curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: text/plain']);

    $response = curl_exec($ch);
    $err = curl_error($ch);
    //if ($err) {
    //   dump($err);
    //}
    //$retcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
    //        $header = substr($response, 0, $header_size);
    $body = substr($response, $header_size);

    curl_close($ch);
    $level = "NOTICE";
    if (strval($response) != 'Success') {
        //dd('err', $response);
        $level = "ERROR";
    }

confignginxbysocketpublic's People

Contributors

leksandre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.