fixPermissions = true; } public function build() { $virtualHostMerged = ' #=========================================================================# # PHYRE HOSTING PANEL - Default Web Domain Template # # DO NOT MODIFY THIS FILE! CHANGES WILL BE LOST WHEN REBUILDING DOMAINS # # https://phyrepanel.com/docs/server-administration/web-templates.html # #=========================================================================# DefaultRuntimeDir ${APACHE_RUN_DIR} PidFile ${APACHE_PID_FILE} Timeout 300 KeepAlive On MaxKeepAliveRequests 100 KeepAliveTimeout 5 User ${APACHE_RUN_USER} Group ${APACHE_RUN_GROUP} HostnameLookups Off ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn IncludeOptional mods-enabled/*.load IncludeOptional mods-enabled/*.conf Listen 80 Listen 443 Listen 443 Options FollowSymLinks AllowOverride None Require all denied AllowOverride None Require all granted Options Indexes FollowSymLinks AllowOverride None Require all granted AccessFileName .htaccess Require all denied LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %O" common LogFormat "%{Referer}i -> %U" referer LogFormat "%{User-agent}i" agent IncludeOptional conf-enabled/*.conf '; $getAllDomains = Domain::all(); foreach ($getAllDomains as $domain) { $domainVirtualHost = $domain->configureVirtualHost($this->fixPermissions); if (isset($domainVirtualHost['apacheBaseConfig'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfig'] . "\n\n"; } if (isset($domainVirtualHost['apacheBaseConfigWithSSL'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfigWithSSL'] . "\n\n"; } } if (!empty(setting('general.master_domain'))) { // Make master domain virtual host $masterDomain = new MasterDomain(); $domainVirtualHost = $masterDomain->configureVirtualHost($this->fixPermissions); if (isset($domainVirtualHost['apacheBaseConfig'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfig'] . "\n\n"; } if (isset($domainVirtualHost['apacheBaseConfigWithSSL'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfigWithSSL'] . "\n\n"; } } $wildcardDomain = setting('general.wildcard_domain'); if (!empty($wildcardDomain)) { // Make wildcard domain virtual host $masterDomain = new MasterDomain(); $masterDomain->domain = $wildcardDomain; $domainVirtualHost = $masterDomain->configureVirtualHost($this->fixPermissions); if (isset($domainVirtualHost['apacheBaseConfig'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfig'] . "\n\n"; } if (isset($domainVirtualHost['apacheBaseConfigWithSSL'])) { $virtualHostMerged .= $domainVirtualHost['apacheBaseConfigWithSSL'] . "\n\n"; } } file_put_contents('/etc/apache2/apache2.conf', $virtualHostMerged); shell_exec('systemctl reload apache2'); } }