Fixes in php
This commit is contained in:
parent
d665b4e8fc
commit
1ff962b2ae
3 changed files with 67 additions and 14 deletions
|
|
@ -22,6 +22,12 @@ $create_dirs=['debian' => ["sudo mkdir -p /etc/apache2/vhosts.d/ && sudo mkdir -
|
|||
|
||||
$create_dirs['ubuntu']=$create_dirs['debian'];
|
||||
|
||||
$create_dirs['fedora']=["sudo mkdir -p /etc/httpd/vhosts.d/{php,extra} "];
|
||||
|
||||
$create_dirs['almalinux']=$create_dirs['fedora'];
|
||||
|
||||
$create_dirs['rocky']=$create_dirs['fedora'];
|
||||
|
||||
Linux::exec($create_dirs);
|
||||
|
||||
if(!file_put_contents('vhosts.conf', $conf_vhosts)) {
|
||||
|
|
@ -34,29 +40,73 @@ $create_vhost_file=['debian' => ["sudo mv vhosts.conf /etc/apache2/sites-enabled
|
|||
|
||||
$create_vhost_file['ubuntu']=$create_vhost_file['debian'];
|
||||
|
||||
//echo 'deb blah ... blah' | sudo tee -a /etc/apt/sources.list
|
||||
|
||||
//$create_vhost_file['fedora']=["sudo mv vhosts.conf /etc/httpd/conf.d/zzz-vhosts.conf && sudo chown root:root /etc/httpd/conf.d/zzz-vhosts.conf && sudo chmod 644 /etc/httpd/conf.d/zzz-vhosts.conf"];
|
||||
|
||||
$create_vhost_file['fedora']=["echo ${conf_vhosts} | sudo tee -a /etc/httpd/conf/httpd.conf"];
|
||||
|
||||
$create_vhost_file['almalinux']=$create_vhost_file['fedora'];
|
||||
|
||||
$create_vhost_file['rocky']=$create_vhost_file['fedora'];
|
||||
|
||||
Linux::exec($create_vhost_file);
|
||||
|
||||
//Modifying apache configuration
|
||||
|
||||
Linux::json_log('Modifying Apache configuration...', $error=0, $status=0, $progress=0, $no_progress=1);
|
||||
|
||||
$sed_apache=['debian' => ['ServerTokens OS', "ServerTokens Prod", '/etc/apache2/conf-enabled/security.conf']];
|
||||
if($linux_distro=='ubuntu' || $linux_distro=='debian') {
|
||||
|
||||
$sed_apache['ubuntu']=$sed_apache['debian'];
|
||||
$sed_apache=['debian' => ['ServerTokens OS', "ServerTokens Prod", '/etc/apache2/conf-enabled/security.conf']];
|
||||
|
||||
Linux::sed($sed_apache);
|
||||
$sed_apache['ubuntu']=$sed_apache['debian'];
|
||||
|
||||
Linux::sed($sed_apache);
|
||||
|
||||
}
|
||||
|
||||
//Activating modules for apache.
|
||||
// In red hat derivatives is different.
|
||||
|
||||
$activate_modules=['debian' => ["sudo a2enmod ssl rewrite proxy proxy_fcgi"]];
|
||||
if($linux_distro=='rocky' || $linux_distro=='almalinux' || $linux_distro=='fedora') {
|
||||
|
||||
#echo 'deb blah ... blah' | sudo tee -a /etc/apt/sources.list
|
||||
|
||||
$add_tokens['rocky']=["sudo echo \"ServerTokens Prod\" | sudo tee -a /etc/httpd/conf.d/tokens.conf"];
|
||||
|
||||
$add_tokens['almalinux']=$add_tokens['rocky'];
|
||||
|
||||
$add_tokens['fedora']=$add_tokens['rocky'];
|
||||
|
||||
Linux::exec($add_tokens);
|
||||
|
||||
}
|
||||
|
||||
$activate_modules['ubuntu']=$create_vhost_file['debian'];
|
||||
//Activating modules for apache/debian.
|
||||
|
||||
Linux::exec($activate_modules);
|
||||
if($linux_distro=='ubuntu' || $linux_distro=='debian') {
|
||||
|
||||
$activate_modules=['debian' => ["sudo a2enmod ssl rewrite proxy proxy_fcgi"]];
|
||||
|
||||
$activate_modules['ubuntu']=$create_vhost_file['debian'];
|
||||
|
||||
Linux::exec($activate_modules);
|
||||
|
||||
}
|
||||
|
||||
if($linux_distro=='rocky' || $linux_distro=='almalinux' || $linux_distro=='fedora') {
|
||||
|
||||
if(Linux::shell_command(['sudo systemctl status firewalld'], 0)==0) {
|
||||
|
||||
Linux::shell_command(["sudo firewall-cmd --add-service=http && sudo firewall-cmd --add-service=http --permanent && sudo firewall-cmd --add-service=https && sudo firewall-cmd --add-service=https --permanent"]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Restart apache
|
||||
|
||||
$linux_service=['debian' => 'apache2', 'ubuntu' => 'apache2', 'fedora' => 'httpd', 'almalinux' => 'httpd', 'rocky' => 'httpd', 'arch' => 'apache'];
|
||||
$linux_service=['debian' => 'apache2', 'ubuntu' => 'apache2', 'fedora' => 'httpd', 'almalinux' => 'httpd', 'rocky' => 'httpd', 'arch' => 'httpd'];
|
||||
|
||||
Linux::systemd_service('restart', $linux_service);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue