Update ISPConfig behind http proxy

Discussion in 'Tips/Tricks/Mods' started by Jesse Norell, Oct 22, 2021.

Tags:
  1. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    When running ISPConfig behind a http proxy (no direct web access) you must configure both php and wget/curl to use the proxy, which can be done by creating (or appending to) `/usr/local/ispconfig/server/lib/config.inc.local.php`:
    Code:
    <?php
    
    # configure http proxy
    $PROXY_HOST = "your-http-proxy.internal.tld"; // Proxy server address
    $PROXY_PORT = "3128";    // Proxy server port
    $PROXY_USER = "";    // Username
    $PROXY_PASS = "";   // Password
    
    # set environment variables for wget and curl
    putenv("http_proxy=http://$PROXY_HOST:$PROXY_PORT/");
    putenv("https_proxy=http://$PROXY_HOST:$PROXY_PORT/");
    
    $defaultContext = array(
      'http' => array(
       'proxy' => "tcp://$PROXY_HOST:$PROXY_PORT",
       'request_fulluri' => true,
      ),
    );
    
    if (strlen($PROXY_USER) > 0 && strlen($PROXY_PASS) > 0) {
      $PROXY_AUTH = "$PROXY_USER:$PROXY_PASS";
      putenv("http_proxy=http://[email protected]$PROXY_HOST:$PROXY_PORT/");
      putenv("https_proxy=http://[email protected]$PROXY_HOST:$PROXY_PORT/");
    
      $PROXY_AUTH = base64_encode($PROXY_AUTH);
      $defaultContext['http']['header'] = "Proxy-Authorization: Basic $PROXY_AUTH";
    }
    
    stream_context_set_default( $defaultContext );
    
    $conf['log_priority'] = 0; // 0 = Debug, 1 = Warning, 2 = Error
    
     
    ahrasis and till like this.

Share This Page