|
@ -168,9 +168,18 @@ class NginxVhostFactory |
|
|
// check status
|
|
|
// check status
|
|
|
if ($menu->getSelectedItem()->getChecked()) { |
|
|
if ($menu->getSelectedItem()->getChecked()) { |
|
|
symlink('/etc/nginx/sites-available/'.$vhost['file'], '/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|
symlink('/etc/nginx/sites-available/'.$vhost['file'], '/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|
|
|
|
|
|
|
exec('nginx -c /etc/nginx/nginx.conf -t 2>&1', $output); |
|
|
exec('nginx -c /etc/nginx/nginx.conf -t 2>&1', $output); |
|
|
|
|
|
$result = preg_match_all("/syntax is ok/", implode(' ', $output), $output); |
|
|
|
|
|
|
|
|
|
|
|
// restart if success message was found
|
|
|
|
|
|
if ($result > 0) { |
|
|
|
|
|
exec('service nginx restart'); |
|
|
|
|
|
$menu->confirm('Success! ')->display('OK!'); |
|
|
|
|
|
|
|
|
if ($output) { |
|
|
|
|
|
|
|
|
$vhost['enabled'] = true; |
|
|
|
|
|
$status = 'enabled'; |
|
|
|
|
|
} else { |
|
|
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|
$menu->confirm('Error! Configuration not Working!')->display('OK!'); |
|
|
$menu->confirm('Error! Configuration not Working!')->display('OK!'); |
|
|
|
|
|
|
|
@ -179,15 +188,6 @@ class NginxVhostFactory |
|
|
|
|
|
|
|
|
$vhost['enabled'] = false; |
|
|
$vhost['enabled'] = false; |
|
|
$status = 'disabled'; |
|
|
$status = 'disabled'; |
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
// restart
|
|
|
|
|
|
exec('service nginx restart'); |
|
|
|
|
|
$menu->confirm('Success! ')->display('OK!'); |
|
|
|
|
|
|
|
|
|
|
|
$vhost['enabled'] = true; |
|
|
|
|
|
$status = 'enabled'; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|
unlink('/etc/nginx/sites-enabled/'.$vhost['file']); |
|
|