Prepare Apache HTTP Server to run as Standalone mode.
505389
private function prepareStandaloneMode()
    {
        $param_path = nbCLICheckOption('p', 'path', ':', false);
        if ($param_path && is_dir($param_path)) {
            $this->mode = CNabuEngine::ENGINE_MODE_STANDALONE;
            $this->host_path = $param_path;
        } else {
            echo "Invalid host path provided for Standalone Engine Mode.\n";
            echo "Please revise your params and try again.\n";
        }
    }
1142112
private function runStandalone()
    {
        $nb_server = new CNabuBuiltInServer();
        $nb_server->setVirtualHostsPath($this->host_path);

        $nb_site = new CNabuBuiltInSite();
        $nb_site->setBasePath('');
        $nb_site->setUseFramework('T');

        $apache_server = new CApacheHTTPServer($nb_server, $nb_site);

        if ($apache_server->locateApacheServer()) {
            $this->displayServerConfig($apache_server);
            if ($this->checkHostFolders($this->host_path)) {
                $apache_server->createStandaloneConfiguration();
            }
        }
    }
742967
def runserver(app=None, reloader=None, debug=None, host=None, port=None):
    """"""
    debug = debug or app.config.get('DEBUG', False)
    reloader = reloader or app.config.get('RELOADER', False)
    host = host or app.config.get('HOST', '127.0.0.1')
    port = port or app.config.get('PORT', 5000)
    app.run(
        use_reloader=reloader,
        debug=debug,
        host=host,
        port=port
    )
806959
def run(options, http_req_handler = HttpReqHandler):
    
    # pylint: disable-msg=W0613
    global _HTTP_SERVER

    for x in ('server_version', 'sys_version'):
        if _OPTIONS.get(x) is not None:
            setattr(http_req_handler, x, _OPTIONS[x])

    _HTTP_SERVER = threading_tcp_server.KillableThreadingHTTPServer(
                       _OPTIONS,
                       (_OPTIONS['listen_addr'], _OPTIONS['listen_port']),
                       http_req_handler,
                       name = "httpdis")

    for name, cmd in _COMMANDS.iteritems():
        if cmd.at_start:
            LOG.info("at_start: %r", name)
            cmd.at_start(options)

    LOG.info("will now serve")
    while not _KILLED:
        try:
            _HTTP_SERVER.serve_until_killed()
        except (socket.error, select.error), why:
            if errno.EINTR == why[0]:
                LOG.debug("interrupted system call")
            elif errno.EBADF == why[0] and _KILLED:
                LOG.debug("server close")
            else:
                raise

    LOG.info("exiting")
939670
def start_http_server(self, port, args):
        
        # Start the HTTP Server
        LOGGER.info("Starting Tornado v%s HTTPServer on port %i Args: %r",
                    tornado_version, port, args)
        http_server = httpserver.HTTPServer(self.app, **args)
        http_server.bind(port, family=socket.AF_INET)
        http_server.start(1)
        return http_server
1076965
def setup_environment():
  
  absl.logging.set_verbosity(absl.logging.WARNING)

  # The default is HTTP/1.0 for some strange reason. If we don't use
  # HTTP/1.1 then a new TCP socket and Python thread is created for
  # each HTTP request. The tradeoff is we must always specify the
  # Content-Length header, or do chunked encoding for streaming.
  serving.WSGIRequestHandler.protocol_version = 'HTTP/1.1'
1009187
def make_server(application, conf_dir=None):
    
    if conf_dir:
        load_config(conf_dir)
    configure_syslog()
    log_config()
    if options.use_ssl:
        ssl_options = ssl_server_options()
        server = tornado.httpserver.HTTPServer(
                application, ssl_options=ssl_options)
        general_logger.info(
                'start tornado https server at https://%s:%s'
                ' with ssl_options: %s', options.ip, options.port, ssl_options)
    else:

        server = tornado.httpserver.HTTPServer(application)
        general_logger.info('start tornado http server at http://{0}:{1}'.format(
                options.ip, options.port))

    server.bind(options.port, options.ip)
    return server
387443
def _do_http(opts, profile='default'):
    '''
    
    '''

    ret = {}

    url = __salt__['config.get']('modjk:{0}:url'.format(profile), '')
    user = __salt__['config.get']('modjk:{0}:user'.format(profile), '')
    passwd = __salt__['config.get']('modjk:{0}:pass'.format(profile), '')
    realm = __salt__['config.get']('modjk:{0}:realm'.format(profile), '')
    timeout = __salt__['config.get']('modjk:{0}:timeout'.format(profile), '')

    if not url:
        raise Exception('missing url in profile {0}'.format(profile))

    if user and passwd:
        auth = _auth(url=url, realm=realm, user=user, passwd=passwd)
        _install_opener(auth)

    url += '?{0}'.format(_urlencode(opts))

    for line in _urlopen(url, timeout=timeout).read().splitlines():
        splt = line.split('=', 1)
        if splt[0] in ret:
            ret[splt[0]] += ',{0}'.format(splt[1])
        else:
            ret[splt[0]] = splt[1]

    return ret
268650
def reload_webservers():
    
    if env.verbosity:
        print env.host, "RELOADING apache2"
    with settings(warn_only=True):
        a = sudo("/etc/init.d/apache2 reload")
        if env.verbosity:
            print '',a        
    if env.verbosity:

        #Reload used to fail on Ubuntu but at least in 10.04 it works
        print env.host,"RELOADING nginx"
    with settings(warn_only=True):
        s = run("/etc/init.d/nginx status")
        if 'running' in s:
            n = sudo("/etc/init.d/nginx reload")
        else:
            n = sudo("/etc/init.d/nginx start")
    if env.verbosity:
        print ' *',n
    return True
1334348
def prepare(self):
        """"""
        p = PreparedRequest()
        p.prepare(
            method=self.method,
            url=self.url,
            headers=self.headers,
            files=self.files,
            data=self.data,
            params=self.params,
            auth=self.auth,
            cookies=self.cookies,
            hooks=self.hooks,
        )
        return p
291177
def run_server(self):
        
        app = build_app()
        run(app, host='localhost', port=self.port)
1374052
def main(argv=None):
    """"""
    #
    # `simpl server`
    #
    logging.basicConfig(level=logging.INFO)
    server_func = functools.partial(server.main, argv=argv)
    server_parser = server.attach_parser(default_subparser())
    server_parser.set_defaults(_func=server_func)

    # the following code shouldn't need to change when
    # we add a new subcommand.
    args = default_parser().parse_args(argv)
    args._func()
345803
def configure
      @web_server.mount('/alive', Alive)
      @web_server.mount('/tasks/new', NewTask, self)
      @web_server.mount('/shutdown', Shutdown)
      @web_server.mount('/response_from_device', ResponseFromDevice, self)
      @web_server.mount('/auto_update_pid', AutoUpdatePID, self)
    end
1022884
protected function prepare()
    {
        //Force passice mode if not specified
        $this->addOption('passive', true);

        //To make call on different files, we must retrieve the root and apply commands to the path
        $tmp = clone $this->getUrl();
        $tmp->path('');
        $this->addOption('url', $tmp->toString());
    }
548206
def serve(application, host='127.0.0.1', port=8080):
	""""""
	
	# Instantiate the server with a host/port configuration and our application.
	WSGIServer((host, int(port)), application).serve_forever()
693613
def main():
    """"""
    parser = argparse.ArgumentParser(
        description='Start an instance of the Cheroot WSGI/HTTP server.',
    )
    for arg, spec in _arg_spec.items():
        parser.add_argument(arg, **spec)
    raw_args = parser.parse_args()

    # ensure cwd in sys.path
    '' in sys.path or sys.path.insert(0, '')

    # create a server based on the arguments provided
    raw_args._wsgi_app.server(raw_args).safe_start()
1047688
public static function startup()
    {
        global $PPHP;

        trigger('language', self::$_req['lang']);

        if (isset(self::$_PATH[1]) && listeners('route/' . self::$_PATH[0] . '+' . self::$_PATH[1])) {
            self::$_base = array_shift(self::$_PATH) . '+' . array_shift(self::$_PATH);
        } elseif (isset(self::$_PATH[0])) {
            if (listeners('route/' . self::$_PATH[0])) {
                self::$_base = array_shift(self::$_PATH);
            } else {
                trigger('http_status', 404);
            };
        } elseif (listeners('route/main')) {
            self::$_base = 'main';
        } else {
            trigger('http_status', 404);
        };
        self::$_req['path_args'] = self::$_PATH;
    }