-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6000149
Showing
22 changed files
with
843 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
debian/.debhelper/ | ||
debian/files | ||
debian/alternc-php-fpm.debhelper.log | ||
debian/alternc-php-fpm.substvars | ||
debian/alternc-php-fpm/ |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/make -f | ||
# ---------------------------------------------------------------------- | ||
# AlternC - Web Hosting System | ||
# Copyright (C) 2000-2013 by the AlternC Development Team. | ||
# https://alternc.org/ | ||
# ---------------------------------------------------------------------- | ||
# LICENSE | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License (GPL) | ||
# as published by the Free Software Foundation; either version 2 | ||
# of the License, or (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# To read the license please visit http://www.gnu.org/copyleft/gpl.html | ||
# ---------------------------------------------------------------------- | ||
# Purpose of file: Global Makefile | ||
# ---------------------------------------------------------------------- | ||
|
||
build: | ||
|
||
install: | ||
install -m 0755 php7-fpm sync-unix-accounts.php $(DESTDIR)/usr/lib/alternc/ | ||
install -m 0644 -o root -g root apache2/* $(DESTDIR)/etc/alternc/templates/apache2/ | ||
install -m 0644 -o root -g root php/* $(DESTDIR)/etc/alternc/templates/php/ | ||
install -m 0644 -o root -g root logrotate $(DESTDIR)/etc/logrotate.d/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<VirtualHost *:80> | ||
ServerName %%fqdn%% | ||
DocumentRoot "%%document_root%%" | ||
AssignUserId #%%UID%% #%%GID%% | ||
SetEnv LOGIN "%%UID%%-%%LOGIN%%" | ||
|
||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php7.0-%%LOGIN%%.sock|fcgi://localhost%%document_root%%" | ||
|
||
RewriteEngine on | ||
RewriteCond %{QUERY_STRING} (%2d|-)d.*auto_prepend [NC] | ||
RewriteRule .? - [F,L] | ||
|
||
<Directory "%%document_root%%"> | ||
require all granted | ||
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp" | ||
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch | ||
AllowOverride AuthConfig FileInfo Limit Options Indexes | ||
php_admin_flag engine off | ||
</Directory> | ||
</VirtualHost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<VirtualHost *:80> | ||
ServerName %%fqdn%% | ||
DocumentRoot "%%document_root%%" | ||
AssignUserId #%%UID%% #%%GID%% | ||
SetEnv LOGIN "%%UID%%-%%LOGIN%%" | ||
|
||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php7.1-%%LOGIN%%.sock|fcgi://localhost%%document_root%%" | ||
|
||
RewriteEngine on | ||
RewriteCond %{QUERY_STRING} (%2d|-)d.*auto_prepend [NC] | ||
RewriteRule .? - [F,L] | ||
|
||
<Directory "%%document_root%%"> | ||
require all granted | ||
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp" | ||
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch | ||
AllowOverride AuthConfig FileInfo Limit Options Indexes | ||
php_admin_flag engine off | ||
</Directory> | ||
</VirtualHost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<VirtualHost *:80> | ||
ServerName %%fqdn%% | ||
DocumentRoot "%%document_root%%" | ||
AssignUserId #%%UID%% #%%GID%% | ||
SetEnv LOGIN "%%UID%%-%%LOGIN%%" | ||
|
||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php7.2-%%LOGIN%%.sock|fcgi://localhost%%document_root%%" | ||
|
||
RewriteEngine on | ||
RewriteCond %{QUERY_STRING} (%2d|-)d.*auto_prepend [NC] | ||
RewriteRule .? - [F,L] | ||
|
||
<Directory "%%document_root%%"> | ||
require all granted | ||
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp" | ||
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch | ||
AllowOverride AuthConfig FileInfo Limit Options Indexes | ||
php_admin_flag engine off | ||
</Directory> | ||
</VirtualHost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<VirtualHost *:80> | ||
ServerName %%fqdn%% | ||
DocumentRoot "%%document_root%%" | ||
AssignUserId #%%UID%% #%%GID%% | ||
SetEnv LOGIN "%%UID%%-%%LOGIN%%" | ||
|
||
ProxyPassMatch "^/(.*\.php(/.*)?)$" "unix:/run/php/php7.3-%%LOGIN%%.sock|fcgi://localhost%%document_root%%" | ||
|
||
RewriteEngine on | ||
RewriteCond %{QUERY_STRING} (%2d|-)d.*auto_prepend [NC] | ||
RewriteRule .? - [F,L] | ||
|
||
<Directory "%%document_root%%"> | ||
require all granted | ||
php_admin_value open_basedir "%%document_root%%:/usr/share/php/:/var/alternc/tmp:/tmp" | ||
Options +MultiViews -FollowSymLinks +SymLinksIfOwnerMatch | ||
AllowOverride AuthConfig FileInfo Limit Options Indexes | ||
php_admin_flag engine off | ||
</Directory> | ||
</VirtualHost> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
alternc-php-fpm (3.3) oldstable; urgency=low | ||
|
||
* Initial module for AlternC | ||
|
||
-- Benjamin Sonntag <[email protected]> Thu, 4 Apr 2018 12:32:33 +0200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
Source: alternc-php-fpm | ||
Section: admin | ||
Priority: optional | ||
Maintainer: Benjamin Sonntag <[email protected]> | ||
Build-Depends: debhelper (>= 8) | ||
Standards-Version: 3.9.8 | ||
|
||
Package: alternc-php-fpm | ||
Priority: optional | ||
Section: admin | ||
Architecture: all | ||
Depends: alternc (>= 3.2.11), php7.0-fpm, php7.1-fpm, php7.2-fpm, php7.3-fpm | ||
Recommends: php7.0-cli,php7.0-common,php7.0-curl,php7.0-gd,php7.0-imap,php7.0-intl,php7.0-json,php7.0-mbstring,php7.0-mcrypt,php7.0-mysql,php7.0-opcache,php7.0-readline,php7.0-soap,php7.0-xml,php7.0-zip,php7.1-cli,php7.1-common,php7.1-imap,php7.1-json,php7.1-opcache,php7.1-readline,php7.2-cli,php7.2-common,php7.2-curl,php7.2-gd,php7.2-imap,php7.2-intl,php7.2-json,php7.2-mbstring,php7.2-mysql,php7.2-opcache,php7.2-readline,php7.2-soap,php7.2-xml,php7.2-zip,php7.3-cli,php7.3-common,php7.3-curl,php7.3-gd,php7.3-imap,php7.3-intl,php7.3-json,php7.3-mbstring,php7.3-mysql,php7.3-opcache,php7.3-readline,php7.3-xml,php7.3-zip | ||
Description: PHP7.x-fpm addon for AlternC | ||
AlternC is a mutualized hosting software manager for Linux. | ||
It allows you to manage your websites, domains, ftp, emails, aliases, | ||
web statistics, mailing-lists, etc. | ||
. | ||
This package is an optional module that adds php7.x-fpm vhost templates | ||
for AlternC. it is compatible with nginx-ssl and recommends | ||
php7.x-fpm sury packages | ||
. | ||
More information on https://www.alternc.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
This package was debianized by Benjamin Sonntag <[email protected]> on | ||
Tue, 4 Apr 2019 11:31:26 +0200. | ||
|
||
It was downloaded from http://www.alternc.org | ||
|
||
Upstream Authors: AlternC Development team <[email protected]> | ||
|
||
Copyright (c) 2002-2008 AlternC Development team <[email protected]> | ||
|
||
Copyright: | ||
|
||
LICENSE | ||
|
||
This program is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU General Public License (GPL) | ||
as published by the Free Software Foundation; either version 2 | ||
of the License, or (at your option) any later version. | ||
|
||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
|
||
On Debian systems, the complete text of the GNU General Public | ||
License can be found in /usr/share/common-licenses/GPL file. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Every 5 minutes, do fpm actions | ||
*/5 * * * * root /usr/lib/alternc/php7-fpm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/usr/lib/alternc | ||
/etc/alternc/templates/php | ||
/etc/alternc/templates/apache2 | ||
/etc/logrotate.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash -e | ||
|
||
case "$1" in | ||
configure) | ||
echo "Installing mysql table" | ||
mysql --defaults-file=/etc/alternc/my.cnf -e " | ||
INSERT IGNORE INTO domaines_type VALUES ('php70-fpm','PHP 7.0 FPM','DIRECTORY','%SUB% IN A @@PUBLIC_IP@@','txt,defmx,defmx2,mx,mx2','ALL',0,0,0,0,0); | ||
INSERT IGNORE INTO domaines_type VALUES ('php71-fpm','PHP 7.1 FPM','DIRECTORY','%SUB% IN A @@PUBLIC_IP@@','txt,defmx,defmx2,mx,mx2','ALL',0,0,0,0,0); | ||
INSERT IGNORE INTO domaines_type VALUES ('php72-fpm','PHP 7.2 FPM','DIRECTORY','%SUB% IN A @@PUBLIC_IP@@','txt,defmx,defmx2,mx,mx2','ALL',0,0,0,0,0); | ||
INSERT IGNORE INTO domaines_type VALUES ('php73-fpm','PHP 7.3 FPM','DIRECTORY','%SUB% IN A @@PUBLIC_IP@@','txt,defmx,defmx2,mx,mx2','ALL',0,0,0,0,0); | ||
" | ||
;; | ||
esac | ||
|
||
# dh_installdeb will replace this with shell code automatically | ||
# generated by other debhelper scripts. | ||
#DEBHELPER# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/make -f | ||
# Sample debian/rules that uses debhelper. | ||
# This file is public domain software, originally written by Joey Hess. | ||
# | ||
# This version is for a multibinary package. It also allows you to build any | ||
# of the binary packages independantly, via binary-<package> targets. | ||
|
||
# Uncomment this to turn on verbose mode. | ||
export DH_VERBOSE=1 | ||
|
||
override_dh_install: | ||
#dh install | ||
$(MAKE) install DESTDIR=$(CURDIR)/debian/alternc-php-fpm | ||
|
||
%: | ||
dh $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# | ||
# Logrotate.d script for AlternC-fpm | ||
# | ||
|
||
/var/log/alternc/php7-fpm.log { | ||
weekly | ||
missingok | ||
create 0640 alterncpanel adm | ||
rotate 8 | ||
compress | ||
delaycompress | ||
dateext | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[%%LOGIN%%] | ||
user = %%LOGIN%% | ||
group = %%LOGIN%% | ||
listen = /run/php/php7.0-%%LOGIN%%.sock | ||
listen.owner = %%LOGIN%% | ||
listen.group = %%LOGIN%% | ||
pm = ondemand | ||
pm.max_children = 10 | ||
pm.process_idle_timeout = 10s | ||
pm.max_requests = 500 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[%%LOGIN%%] | ||
user = %%LOGIN%% | ||
group = %%LOGIN%% | ||
listen = /run/php/php7.1-%%LOGIN%%.sock | ||
listen.owner = %%LOGIN%% | ||
listen.group = %%LOGIN%% | ||
pm = ondemand | ||
pm.max_children = 10 | ||
pm.process_idle_timeout = 10s | ||
pm.max_requests = 500 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[%%LOGIN%%] | ||
user = %%LOGIN%% | ||
group = %%LOGIN%% | ||
listen = /run/php/php7.2-%%LOGIN%%.sock | ||
listen.owner = %%LOGIN%% | ||
listen.group = %%LOGIN%% | ||
pm = ondemand | ||
pm.max_children = 10 | ||
pm.process_idle_timeout = 10s | ||
pm.max_requests = 500 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[%%LOGIN%%] | ||
user = %%LOGIN%% | ||
group = %%LOGIN%% | ||
listen = /run/php/php7.3-%%LOGIN%%.sock | ||
listen.owner = %%LOGIN%% | ||
listen.group = %%LOGIN%% | ||
pm = ondemand | ||
pm.max_children = 10 | ||
pm.process_idle_timeout = 10s | ||
pm.max_requests = 500 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/php | ||
<?php | ||
|
||
/* This crontab adds/remove FPM pools for php 7.0/1/2/3 | ||
for each user who uses a fpm configuration | ||
*/ | ||
|
||
require_once("/usr/share/alternc/panel/class/config_nochk.php"); | ||
|
||
// first launch sync_unix since we NEED unix user to exist! | ||
passthru("/usr/lib/alternc/sync-unix-accounts.php"); | ||
|
||
$db->query("SELECT DISTINCT m.login,m.uid,sd.type FROM sub_domaines sd, membres m WHERE m.uid=sd.compte AND sd.type IN ('php70-fpm','php71-fpm','php72-fpm','php73-fpm');"); | ||
|
||
$reload=array(); | ||
$allpools=array(); | ||
$allversions=array("7.0","7.1","7.2","7.3"); | ||
|
||
function myecho($str) { | ||
static $first=true; | ||
if ($first) { | ||
echo date("Y-m-d H:i:s")." Log of php7-fpm\n"; | ||
$first=false; | ||
} | ||
echo $str."\n"; | ||
} | ||
|
||
while ($db->next_record()) { | ||
$version=substr($db->f("type"),3,1).".".substr($db->f("type"),4,1); | ||
$user=$db->f("login"); | ||
$allpools[$version][]=$user; | ||
if (!is_file("/etc/php/".$version."/fpm/pool.d/".$user.".alternc.conf")) { | ||
myecho("Creating php $version fpm pool for user $user"); | ||
file_put_contents("/etc/php/".$version."/fpm/pool.d/".$user.".alternc.conf", | ||
str_replace("%%LOGIN%%",$user, | ||
file_get_contents("/etc/alternc/templates/php/fpm-".$version) | ||
)); | ||
$reload[$version]=$version; | ||
} | ||
} | ||
|
||
// now delete pools we don't need anymore | ||
foreach($allversions as $version) { | ||
$d=opendir("/etc/php/$version/fpm/pool.d"); | ||
while (($c=readdir($d))!==false) { | ||
if (preg_match('#/([^/]*).alternc.conf$#',$c,$mat)) { | ||
$user=$mat[1]; | ||
if (!in_array($user,$allpools[$version])) { | ||
echo("Deleting php $version fpm pool for user $user"); | ||
@unlink("/etc/php/".$version."/fpm/pool.d/".$user.".alternc.conf"); | ||
$reload[$version]=$version; | ||
} | ||
} | ||
} | ||
} | ||
|
||
// now reloads php fpm versions | ||
foreach($reload as $service) { | ||
passthru("/etc/init.d/php".$service."-fpm reload"); | ||
} | ||
|
Oops, something went wrong.