server_rec API

The server records that Apache uses contain a ton of useful information. While modules do not generally use all of these attributes, some of them are fairly useful and important.

next

Synopsis

server_rec.next

Description

Within the Apache webserver, many virtual-hosts can be run simultaneously. The servers are stored in a linked list within the server, and the next attribute returns the next server in the list.

def_name

Synopsis

server_rec.def_name

Description

This string attribute contains the definition name of the server, as from the configuration file. In the case of the main server, this value is None

defn_line_number

Synopsis

server_rec.defn_line_number

Description

This integer attribute contains the line number of the VirtualHost directive for which the server was created.

server_admin

Synopsis

server_rec.server_admin

Description

This attribute contains the server admin string, as specified within the configuration file by the ServerAdmin directive.

server_hostname

Synopsis

server_rec.server_hostname

Description

This attribute contains the server hostname string, as specified within the configuration file by the ServerName directive.

port

Synopsis

server_rec.port

Description

This attribute contains the port number that the server is running on.

is_virtual

Synopsis

server_rec.is_virtual

Description

Attribute specifying whether or not a given server is a virtual server or not (true or false)

path

Synopsis

server_rec.path

Description

Attribute specifying the pathname, as given by the ServerPath directive within the configuration file.

names

Synopsis

server_rec.names

Description

Returns a tuple containing the names as denoted by ServerAlias

wild_names

Synopsis

server_rec.wild_names

Description

Returns a tuple containing the wildcarded names as denoted by ServerAlias.

server_uid

Synopsis

server_rec.server_uid

Description

Returns the effective user id when calling the exec wrapper

server_gid

Synopsis

server_rec.server_gid

Description

Returns the effective group id when calling the exec wrapper.