mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-21 23:20:24 +00:00
fix domain suspension
This commit is contained in:
parent
1f0ecd1011
commit
0bb29e50cd
3 changed files with 55 additions and 42 deletions
|
@ -260,9 +260,6 @@ class Domain extends Model
|
|||
$apacheVirtualHostBuilder->setHomeRoot($this->home_root);
|
||||
$apacheVirtualHostBuilder->setUser($findHostingSubscription->system_username);
|
||||
$apacheVirtualHostBuilder->setUserGroup($webUserGroup);
|
||||
$apacheVirtualHostBuilder->setAdditionalServices($findHostingPlan->additional_services);
|
||||
$apacheVirtualHostBuilder->setAppType($appType);
|
||||
$apacheVirtualHostBuilder->setAppVersion($appVersion);
|
||||
|
||||
if ($this->status == self::STATUS_SUSPENDED) {
|
||||
$suspendedPath = '/var/www/html/suspended';
|
||||
|
@ -275,9 +272,7 @@ class Domain extends Model
|
|||
}
|
||||
$apacheVirtualHostBuilder->setDomainRoot($suspendedPath);
|
||||
$apacheVirtualHostBuilder->setDomainPublic($suspendedPath);
|
||||
}
|
||||
|
||||
if ($this->status == self::STATUS_DEACTIVATED) {
|
||||
} else if ($this->status == self::STATUS_DEACTIVATED) {
|
||||
$deactivatedPath = '/var/www/html/deactivated';
|
||||
if (!is_dir($deactivatedPath)) {
|
||||
mkdir($deactivatedPath, 0755, true);
|
||||
|
@ -288,47 +283,53 @@ class Domain extends Model
|
|||
}
|
||||
$apacheVirtualHostBuilder->setDomainRoot($deactivatedPath);
|
||||
$apacheVirtualHostBuilder->setDomainPublic($deactivatedPath);
|
||||
}
|
||||
} else {
|
||||
|
||||
if ($this->server_application_type == 'apache_nodejs') {
|
||||
$apacheVirtualHostBuilder->setAppType('nodejs');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('node');
|
||||
$apacheVirtualHostBuilder->setPassengerStartupFile('app.js');
|
||||
$apacheVirtualHostBuilder->setEnableLogs(true);
|
||||
$apacheVirtualHostBuilder->setAdditionalServices($findHostingPlan->additional_services);
|
||||
$apacheVirtualHostBuilder->setAppType($appType);
|
||||
$apacheVirtualHostBuilder->setAppVersion($appVersion);
|
||||
|
||||
if (isset($this->server_application_settings['nodejs_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['nodejs_version']);
|
||||
}
|
||||
}
|
||||
if ($this->server_application_type == 'apache_nodejs') {
|
||||
$apacheVirtualHostBuilder->setAppType('nodejs');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('node');
|
||||
$apacheVirtualHostBuilder->setPassengerStartupFile('app.js');
|
||||
|
||||
if ($this->server_application_type == 'apache_python') {
|
||||
$apacheVirtualHostBuilder->setAppType('python');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('python');
|
||||
|
||||
if (isset($this->server_application_settings['python_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['python_version']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->server_application_type == 'apache_ruby') {
|
||||
$apacheVirtualHostBuilder->setAppType('ruby');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('ruby');
|
||||
|
||||
if (isset($this->server_application_settings['ruby_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['ruby_version']);
|
||||
if (isset($this->server_application_settings['nodejs_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['nodejs_version']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if ($this->server_application_type == 'apache_docker') {
|
||||
if (isset($this->server_application_settings['docker_container_id'])) {
|
||||
$findDockerContainer = DockerContainer::where('id', $this->server_application_settings['docker_container_id'])
|
||||
->first();
|
||||
if ($findDockerContainer) {
|
||||
$apacheVirtualHostBuilder->setProxyPass('http://127.0.0.1:'.$findDockerContainer->external_port.'/');
|
||||
$apacheVirtualHostBuilder->setAppType('docker');
|
||||
$apacheVirtualHostBuilder->setAppVersion($appVersion);
|
||||
if ($this->server_application_type == 'apache_python') {
|
||||
$apacheVirtualHostBuilder->setAppType('python');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('python');
|
||||
|
||||
if (isset($this->server_application_settings['python_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['python_version']);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->server_application_type == 'apache_ruby') {
|
||||
$apacheVirtualHostBuilder->setAppType('ruby');
|
||||
$apacheVirtualHostBuilder->setPassengerAppRoot($this->domain_public);
|
||||
$apacheVirtualHostBuilder->setPassengerAppType('ruby');
|
||||
|
||||
if (isset($this->server_application_settings['ruby_version'])) {
|
||||
$apacheVirtualHostBuilder->setAppVersion($this->server_application_settings['ruby_version']);
|
||||
}
|
||||
|
||||
}
|
||||
if ($this->server_application_type == 'apache_docker') {
|
||||
if (isset($this->server_application_settings['docker_container_id'])) {
|
||||
$findDockerContainer = DockerContainer::where('id', $this->server_application_settings['docker_container_id'])
|
||||
->first();
|
||||
if ($findDockerContainer) {
|
||||
$apacheVirtualHostBuilder->setProxyPass('http://127.0.0.1:' . $findDockerContainer->external_port . '/');
|
||||
$apacheVirtualHostBuilder->setAppType('docker');
|
||||
$apacheVirtualHostBuilder->setAppVersion($appVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ class ApacheVirtualHostBuilder
|
|||
|
||||
public $proxyPass = null;
|
||||
|
||||
public $enableLogs = false;
|
||||
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->port = $port;
|
||||
|
@ -131,6 +133,11 @@ class ApacheVirtualHostBuilder
|
|||
$this->proxyPass = $proxyPass;
|
||||
}
|
||||
|
||||
public function enableLogs($enableLogs)
|
||||
{
|
||||
$this->enableLogs = $enableLogs;
|
||||
}
|
||||
|
||||
public function buildConfig()
|
||||
{
|
||||
$settings = [
|
||||
|
@ -153,6 +160,7 @@ class ApacheVirtualHostBuilder
|
|||
'passengerAppType' => $this->passengerAppType,
|
||||
'passengerStartupFile' => $this->passengerStartupFile,
|
||||
'proxyPass' => $this->proxyPass,
|
||||
'enableLogs' => $this->enableLogs,
|
||||
];
|
||||
|
||||
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);
|
||||
|
|
|
@ -31,12 +31,16 @@
|
|||
|
||||
@endif
|
||||
|
||||
@if($enableLogs)
|
||||
|
||||
LogFormat "%h %l %u %t \"%r\" %>s %b" common
|
||||
|
||||
CustomLog {{$domainRoot}}/logs/apache2/bytes.log bytes
|
||||
CustomLog {{$domainRoot}}/logs/apache2/access.log common
|
||||
ErrorLog {{$domainRoot}}/logs/apache2/error.log
|
||||
|
||||
@endif
|
||||
|
||||
@if($appType == 'php')
|
||||
|
||||
ScriptAlias /cgi-bin/ {{$domainPublic}}/cgi-bin/
|
||||
|
|
Loading…
Reference in a new issue