File manager - Edit - /usr/local/CyberCP/ApachController/__pycache__/ApacheController.cpython-310.pyc
Back
o �h]4 � @ sN d dl Z d dlZd dlZd dlmZ d dlmZ d dlm Z G dd� d�Z dS )� N)�ApacheVhost)�ProcessUtilitiesc @ s e Zd ZdZe�� ejkse�� ejkr9dZdZ dZ dZdZdZ dZd Zd ZdZdZd ZdZdZdZdZdZdZn$dZdZ dZ dZdZdZ dZdZdZdZdZdZd Zd!Zd"Zd#Zd$Zd%Zd&Zd'Zed(d)� �Zed*d+� �Zed,d-� �Zed.d/� �Z ed0d1� �Z!d2S )3�ApacheControllerz$/home/cyberpanel/apacheInstallStatusz /etc/httpdz/etc/httpd/conf.d/z /etc/opt/remiz#/opt/remi/php54/root/etc/php-fpm.d/z#/opt/remi/php55/root/etc/php-fpm.d/z/etc/opt/remi/php56/php-fpm.d/z/etc/opt/remi/php70/php-fpm.d/z/etc/opt/remi/php71/php-fpm.d/z/etc/opt/remi/php72/php-fpm.d/z/etc/opt/remi/php73/php-fpm.d/z/etc/opt/remi/php74/php-fpm.d/z/etc/opt/remi/php80/php-fpm.d/z/etc/opt/remi/php81/php-fpm.d/z/etc/opt/remi/php82/php-fpm.d/z/etc/opt/remi/php83/php-fpm.d/z/etc/opt/remi/php84/php-fpm.d/z/etc/opt/remi/php85/php-fpm.d/�httpdz/etc/apache2z/etc/apache2/sites-enabled/z/etc/phpz/etc/php/5.4/fpm/pool.d/z/etc/php/5.5/fpm/pool.d/z/etc/php/5.6/fpm/pool.d/z/etc/php/7.0/fpm/pool.d/z/etc/php/7.1/fpm/pool.d/z/etc/php/7.2/fpm/pool.d/z/etc/php/7.3/fpm/pool.d/z/etc/php/7.4/fpm/pool.d/z/etc/php/8.0/fpm/pool.d/z/etc/php/8.1/fpm/pool.d/z/etc/php/8.2/fpm/pool.d/z/etc/php/8.3/fpm/pool.d/z/etc/php/8.4/fpm/pool.d/z/etc/php/8.5/fpm/pool.d/�apache2a� # Select the MPM module which should be used by uncommenting exactly # one of the following LoadModule lines: # prefork MPM: Implements a non-threaded, pre-forking web server # See: http://httpd.apache.org/docs/2.4/mod/prefork.html #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so # worker MPM: Multi-Processing Module implementing a hybrid # multi-threaded multi-process web server # See: http://httpd.apache.org/docs/2.4/mod/worker.html # #LoadModule mpm_worker_module modules/mod_mpm_worker.so # event MPM: A variant of the worker MPM with the goal of consuming # threads only for connections with active processing # See: http://httpd.apache.org/docs/2.4/mod/event.html # LoadModule mpm_event_module modules/mod_mpm_event.so <IfModule mpm_event_module> StartServers 2 MinSpareThreads 25 MaxSpareThreads 75 ThreadLimit 64 ThreadsPerChild 25 MaxRequestWorkers 30 MaxConnectionsPerChild 1000 </IfModule>z%/etc/httpd/conf.modules.d/00-mpm.confc C s^ z t j�tj�rW dS W dS ty. } zdt| �df }tj� |� W Y d } ~ d S d } ~ ww )N� r z%s. [%s]z)[ApacheController.checkIfApacheInstalled]) �os�path�existsr � php80Path� BaseException�str�logging�CyberCPLogFileWriter�writeToFile)�msg�message� r �6/usr/local/CyberCP/ApachController/ApacheController.py�checkIfApacheInstalled\ s &��z'ApacheController.checkIfApacheInstalledc C s\ zt �t�| ��}|dkrW dS W dS ty- } ztj�t|�� W Y d }~dS d }~ww )Nr r ) � subprocess�call�shlex�splitr r r r r )�command�resr r r r �executioner� s ��zApacheController.executionerc C s� �zYt �� t jkst �� t jkrd} nd} t �| d d�dkr!W dS t �� t jks/t �� t jkr�d}tj�|�r<t�|� t j d }t|d��� }|� d �d kr�t|d��� }t|d�}|D ]V}|� d�d krz|� d �d krz|� d�d krz|�d� q]|� d�d kr�|� d�d kr�|�d� q]|� d�d kr�|� d�d kr�|�d� |�d� q]|d dkr�q]|�|� q]|�� ttjd�}|�tj� |�� ndt j d }d}t|d�}|�d� |�� d|� �} t �| d d�dkr�W dS d|� �} t �| d d�dk�rW dS d} t �| d d�dk�rW dS d} t �| d d�dk�rW dS t|d�}|�d � |�� t �� t jk�s=t �� t jk�r@d!} nd"} d#| � d$�} t�| � d%| � d$�} t�| � W d&S t�yq } z t| �W Y d } ~ S d } ~ ww )'Nz0yum install -y httpd httpd-tools mod_ssl php-fpmz>apt update -y && sudo apt upgrade -y && apt install apache2 -yTr �%Failed to install Apache and PHP-FPM.z/etc/httpd/conf.d/ssl.confz/conf/httpd.conf�rzListen 8083����w�Listen�80�#zListen 8083 Listen 8082 �UserzUser nobody �Groupz Group nobody z6SetEnv LSWS_EDITION Openlitespeed SetEnv X-LSCACHE on z /apache2.confz/etc/apache2/ports.confz1sed -i 's/User ${APACHE_RUN_USER}/User nobody/g' zApache run user change failedz5sed -i 's/Group ${APACHE_RUN_GROUP}/Group nogroup/g' zApache run group change failedz*apt-get install apache2-suexec-pristine -yz"Apache run apache2-suexec-pristinez9a2enmod suexec proxy ssl proxy_fcgi proxy rewrite headerszApache run suexec proxy ssl�az7 SetEnv LSWS_EDITION Openlitespeed SetEnv X-LSCACHE on r r zsystemctl start z.servicezsystemctl enable r )r �decideDistro�centos�cent8r r r r �remover �serverRootPath�open�read�find� readlines� writelines�closer �mpmConfigsPath�write� mpmConfigsr r )r �sslPath�confPath�CurrentConf�datar �items� portsPath�WriteToFile�serviceNamer r r r � InstallApache� s~ * � ��zApacheController.InstallApachec C s� t �� t jkst �� t jkr+t jdkrd} nd} t�| � d} t �| d d�dkr*dS n4d} t �| d d�dkr8d S d } t �| d d�dkrEdS d} t �| d d�dkrRd S d} t �| d d�dkr_dS ddlm} |� � dS )Nr zFyum install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpmzFyum install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpmz�yum install -y php?? php??-php-fpm php??-php-mysql php??-php-curl php??-php-gd php??-php-mbstring php??-php-xml php??-php-zip php??-php-intlTr zFailed to install php54-fpmz-apt-get install software-properties-common -yz,Failed to install software-properties-commonz)apt install python-software-properties -yz,Failed to install python-software-propertiesz$add-apt-repository ppa:ondrej/php -yzFailed to ppa:ondrej/phpz�DEBIAN_FRONTEND=noninteractive apt-get install -y php-fpm php?.?-fpm php?.?-fpm php?.?-mysql php?.?-curl php?.?-gd php?.?-mbstring php?.?-xml php?.?-zip php?.?-intlr )�Upgrade) r r'