mirror of
https://github.com/cytopia/devilbox.git
synced 2025-02-21 09:51:49 +00:00
REL-0.9 Better mass virtual hosting wildcards
This commit is contained in:
parent
bb0abf4794
commit
54e00598cd
@ -1,30 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// TODO: logpath could also be passed via CMD argument
|
|
||||||
// so this script could be more general
|
|
||||||
$path = '/var/log/apache-2.2';
|
|
||||||
$fh_timeout = 30; // 30 sek.
|
|
||||||
|
|
||||||
$fd = fopen('php://stdin', 'r');
|
|
||||||
|
|
||||||
while (!feof($fd)) {
|
|
||||||
|
|
||||||
$row = fgets($fd);
|
|
||||||
|
|
||||||
list($vhost, $h, $l, $u, $t, $r, $s, $b, $referrer, $ua) = explode(';', $row, 10);
|
|
||||||
|
|
||||||
if (!isset(${$vhost})) {
|
|
||||||
${$vhost} = fopen($path . '/' . $vhost . '_access.log', 'a+');
|
|
||||||
}
|
|
||||||
$lastwrite[$vhost] = time();
|
|
||||||
fputs(${$vhost}, "$h $l $u $t $r $s $b $referrer $ua");
|
|
||||||
|
|
||||||
foreach ($lastwrite as $vhost => $time) {
|
|
||||||
if ((time() - ($time + 30)) >= 0) {
|
|
||||||
fclose(${$vhost});
|
|
||||||
unset(${$vhost});
|
|
||||||
unset($lastwrite[$vhost]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
#!/usr/bin/env php
|
|
||||||
<?php
|
|
||||||
|
|
||||||
// TODO: logpath could also be passed via CMD argument
|
|
||||||
// so this script could be more general
|
|
||||||
$path = '/var/log/apache-2.4';
|
|
||||||
$fh_timeout = 30; // 30 sek.
|
|
||||||
|
|
||||||
$fd = fopen('php://stdin', 'r');
|
|
||||||
|
|
||||||
while (!feof($fd)) {
|
|
||||||
|
|
||||||
$row = fgets($fd);
|
|
||||||
|
|
||||||
list($vhost, $h, $l, $u, $t, $r, $s, $b, $referrer, $ua) = explode(';', $row, 10);
|
|
||||||
|
|
||||||
if (!isset(${$vhost})) {
|
|
||||||
${$vhost} = fopen($path . '/' . $vhost . '_access.log', 'a+');
|
|
||||||
}
|
|
||||||
$lastwrite[$vhost] = time();
|
|
||||||
fputs(${$vhost}, "$h $l $u $t $r $s $b $referrer $ua");
|
|
||||||
|
|
||||||
foreach ($lastwrite as $vhost => $time) {
|
|
||||||
if ((time() - ($time + 30)) >= 0) {
|
|
||||||
fclose(${$vhost});
|
|
||||||
unset(${$vhost});
|
|
||||||
unset($lastwrite[$vhost]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,6 +5,10 @@ NameVirtualHost *:80
|
|||||||
|
|
||||||
<VirtualHost _default_:80>
|
<VirtualHost _default_:80>
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
|
ServerAlias 127.0.0.1
|
||||||
|
ServerAlias 172.16.238.*
|
||||||
|
ServerAlias httpd
|
||||||
|
|
||||||
ServerAdmin root@localhost
|
ServerAdmin root@localhost
|
||||||
|
|
||||||
ErrorLog /var/log/apache-2.2/localhost-error.log
|
ErrorLog /var/log/apache-2.2/localhost-error.log
|
||||||
@ -26,6 +30,3 @@ NameVirtualHost *:80
|
|||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,15 +8,12 @@
|
|||||||
UseCanonicalName Off
|
UseCanonicalName Off
|
||||||
|
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
ServerAlias *.loc
|
ServerAlias *.*
|
||||||
ServerAdmin root@localhost
|
ServerAdmin root@localhost
|
||||||
|
|
||||||
# splitlogs.php is a custom script, which will filter the domain
|
|
||||||
# and create separate logfiles per domain.
|
|
||||||
LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon
|
LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon
|
||||||
CustomLog "|/opt/bin/splitlogs.php" vcommon
|
CustomLog "/var/log/apache-2.2/projects-access.log" vcommon
|
||||||
|
ErrorLog /var/log/apache-2.2/projects-error.log
|
||||||
ErrorLog /var/log/apache-2.2/other-error.log
|
|
||||||
|
|
||||||
DirectoryIndex index.php index.html
|
DirectoryIndex index.php index.html
|
||||||
|
|
||||||
@ -38,6 +35,3 @@
|
|||||||
Allow from all
|
Allow from all
|
||||||
</Directory>
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
|
|
||||||
<VirtualHost _default_:80>
|
<VirtualHost _default_:80>
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
|
ServerAlias 127.0.0.1
|
||||||
|
ServerAlias 172.16.238.*
|
||||||
|
ServerAlias httpd
|
||||||
|
|
||||||
ServerAdmin root@localhost
|
ServerAdmin root@localhost
|
||||||
|
|
||||||
ErrorLog /var/log/apache-2.4/localhost-error.log
|
ErrorLog /var/log/apache-2.4/localhost-error.log
|
||||||
@ -27,6 +31,3 @@
|
|||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -8,15 +8,12 @@
|
|||||||
UseCanonicalName Off
|
UseCanonicalName Off
|
||||||
|
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
ServerAlias *.loc
|
ServerAlias *.*
|
||||||
ServerAdmin root@localhost
|
ServerAdmin root@localhost
|
||||||
|
|
||||||
# splitlogs.php is a custom script, which will filter the domain
|
|
||||||
# and create separate logfiles per domain.
|
|
||||||
LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon
|
LogFormat "%V;%h;%l;%u;%t;\"%r\";%>s;%b;\"%{Referer}i\";\"%{User-agent}i\"" vcommon
|
||||||
CustomLog "|/opt/bin/splitlogs.php" vcommon
|
CustomLog "/var/log/apache-2.4/projects-access.log" vcommon
|
||||||
|
ErrorLog /var/log/apache-2.4/projects-error.log
|
||||||
ErrorLog /var/log/apache-2.4/other-error.log
|
|
||||||
|
|
||||||
DirectoryIndex index.php index.html
|
DirectoryIndex index.php index.html
|
||||||
|
|
||||||
@ -39,6 +36,3 @@
|
|||||||
Require all granted
|
Require all granted
|
||||||
</Directory>
|
</Directory>
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
server_name localhost;
|
||||||
|
server_name 127\.0\.0\.1;
|
||||||
|
server_name httpd;
|
||||||
|
server_name 172\.16\.238\..*;
|
||||||
|
|
||||||
|
|
||||||
# Root directive
|
# Root directive
|
||||||
root /var/www/default/htdocs;
|
root /var/www/default/htdocs;
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name ~^(?<domain>.+)\.loc$;
|
server_name ~^(?<domain>.+)\.[a-zA-Z]+$;
|
||||||
|
|
||||||
# Root directive
|
# Root directive
|
||||||
root /shared/httpd/$domain/htdocs/;
|
root /shared/httpd/$domain/htdocs/;
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
access_log /var/log/nginx-mainline/$domain-access.log main;
|
access_log /var/log/nginx-mainline/projects-access.log main;
|
||||||
error_log /var/log/nginx-mainline/other-error.log warn;
|
error_log /var/log/nginx-mainline/projects-error.log warn;
|
||||||
|
|
||||||
|
|
||||||
# Front-controller pattern as recommended by the nginx docs
|
# Front-controller pattern as recommended by the nginx docs
|
||||||
|
@ -5,6 +5,10 @@
|
|||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
server_name _;
|
server_name _;
|
||||||
|
server_name localhost;
|
||||||
|
server_name 127\.0\.0\.1;
|
||||||
|
server_name httpd;
|
||||||
|
server_name 172\.16\.238\..*;
|
||||||
|
|
||||||
# Root directive
|
# Root directive
|
||||||
root /var/www/default/htdocs;
|
root /var/www/default/htdocs;
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name ~^(?<domain>.+)\.loc$;
|
server_name ~^(?<domain>.+)\.[a-zA-Z]+$;
|
||||||
|
|
||||||
# Root directive
|
# Root directive
|
||||||
root /shared/httpd/$domain/htdocs/;
|
root /shared/httpd/$domain/htdocs/;
|
||||||
index index.php;
|
index index.php;
|
||||||
|
|
||||||
access_log /var/log/nginx-stable/$domain-access.log main;
|
access_log /var/log/nginx-stable/projects-access.log main;
|
||||||
error_log /var/log/nginx-stable/other-error.log warn;
|
error_log /var/log/nginx-stable/projects-error.log warn;
|
||||||
|
|
||||||
|
|
||||||
# Front-controller pattern as recommended by the nginx docs
|
# Front-controller pattern as recommended by the nginx docs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user