Skip to content
  • Solutions
    By Role
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    • For Developers
    • For Content Managers
    • For Agencies
    • For IT Admins
    • For Web Hosters
    By Infrastructure
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Overview
    • AWS
    • Microsoft Azure
    • Alibaba Cloud
    • Google Cloud Platform
    • Vultr
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
    • Digital Ocean
    • Linode
    • Upcloud
    • Oracle
    • OVH
  • Product
    • Plesk Features
    • Plesk Editions
    • What’s new
    • Pricing
    • Roadmap
    • Lifecycle Policy
    • Extensions Catalogue
  • Pricing
  • Extensions
    Featured Extensions
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    • SocialBee
    • WP Toolkit
    • Sitejet Builder for Plesk
    • SEO Toolkit
    • Joomla! Toolkit
    • Premium Email
    • Email Security
    Bundles and packs:
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack
    • Business and Collaboration Edition
    • WP pack
    • Hosting pack
    • Power pack
    • Language pack

    See all Extensions

  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
  • Pricing
  • Solutions
    • By Role
      • For Developers
      • For Content Managers
      • For Agencies
      • For IT Admins
      • For Web Hosters
    • By Infrastructure
      • Overview
      • Plesk on Amazon Web Services (AWS & Lightsail)
      • Microsoft Azure
      • Alibaba Cloud
      • Google Cloud Platform
      • Vultr
      • DigitalOcean
      • Linode
      • UpCloud
      • Oracle
      • OVH
  • Products
  • Pricing
  • Extensions
    • Featured Extensions
      • SocialBee
      • WP Toolkit
      • Sitejet Builder for Plesk
      • SEO Toolkit
      • Joomla! Toolkit
      • Premium Email
      • Email Security
    • Bundles and packs:
      • Business and Collaboration Edition
      • WP pack
      • Hosting pack
      • Power pack
      • Language pack
      • See all Extensions
  • For Partners
    • Plesk Contributor Program
    • Plesk Partner Program
    • Affiliate Program
    • Plesk University
  • Help Center
    • Documentation
    • Professional Services
    • Support
    • Contact Us
    • Wiki
    • Forum
  • Plesk 360 login
  • Free Trial
Plesk 360 login
Free Trial

Knowledge Base

Web Server

 
extensions guideintegrate with system servicesplesk features available for extensionsweb serverapache

Using Plesk SDK API, an extension can make changes to the web server
configuration.

  • Class
    pm_Hook_WebServer
    allows to describe custom directives for domains to be added to the
    configuration files.
  • Class
    pm_WebServer
    is used to instruct the web server to update the configuration for
    the specified domain.

Note: The following sample project is provided by Plesk to illustrate how
an extension can add changes to the web server configuration files:
https://github.com/plesk/ext-web-server.

Adding Custom Configuration

The following methods of the class
pm_Hook_WebServer
are used to describe custom directives introduced by the extension into
the web server configuration files:

  • getDomainApacheConfig(pm_Domain $domain) - returns the string
    which will be added to the Apache configuration as a
    <VirtualHost></VirtualHost> custom directive.
  • getDomainNginxConfig(pm_Domain $domain) - returns the string
    which will be added to nginx configuration as a {...} custom
    directive when nginx is used as the main web server.
  • getDomainNginxProxyConfig((pm_Domain $domain) - returns the
    string which will be added to nginx configuration as a {...}
    custom directive when nginx is used in proxy mode.
  • getDomainIisConfig(pm_Domain $domain) - returns XML as a string
    which will be added to the Plesk IIS configurator.

Every time a domain is reconfigured, these methods will be called.

class Modules_WebServer_WebServer extends pm_Hook_WebServer
{
    public function getDomainApacheConfig(pm_Domain $domain)
    {
        return '# Apache config for domain: ' . $domain->getName();
    }
    public function getDomainNginxConfig(pm_Domain $domain)
    {
        return '# Nginx config for domain name: ' . $domain->getName();
    }
}

Updating Domain Configuration

Method
pm_WebServer::updateDomainConfiguration()
is used to immediately update the specified domain configuration. For
example, this can be done when some additional service was activated on
that domain by the extension.

$webServerManager = new pm_WebServer();
$webServerManager->updateDomainConfiguration(new pm_Domain(1));
Tweet
Share
Share
Email
0 Shares
Read the full article
Related Posts

Your Complete .htaccess Guide: Including .htaccess Basics and More

Read More »

NGINX vs Apache – Which Is the Best Web Server in 2024?

Read More »

403 Forbidden Error: What Is It & How To Fix It

Read More »
Knowledge Base

Apache and Nginx Configuration Files

Read More »

Optimizing Apache Web Server – Setting Up the Apache Restart Interval

Read More »

IIS Web Server Settings – Directory Security Settings

Read More »

IIS Web Server Settings – Common Settings

Read More »

Hosting Wiki

  • GIT
  • Server Redundancy
  • GitHub
  • Bare Metal Server
  • Oracle VM Server
  • Server Virtualization Software
  • Windows Server
  • Domain
  • Plesk
  • Apache Tomcat
  • NGINX
  • Apache
  • Web Server
  • DNS Server
  • HTTP
X-twitter Linkedin Youtube Reddit Github
  • Product
  • Login
  • Pricing
  • Editions
  • For Partners
  • Partner Program
  • Contributor Program
  • Affiliate Program
  • Plesk University
  • Company
  • Blog
  • Careers
  • Events
  • About Plesk
  • Our Brand
  • Resources
  • User and Admin guides
  • Help Center
  • Migrate to Plesk
  • Contact Us
  • Hosting Wiki
  • Forum
  • Legal
  • Legal
  • Privacy Policy
  • Imprint

© 2025 WebPros International GmbH

Part of the WebPros®  Family