Forum

ToolKits for multiple VirtualHost

Tony
17 March 2015, 05:01
Hello,

@Hugo
First at all thank you for this work. It has well performance that I need. But I moved from nginx. And I have some questions.

I want to make acceptable ToolKits for multiple Virtual Hosts. For example I want to DenyAccess if referer not the same with virtual hosts domain. I have to add ToolKit each VirtualHost?

And the same point. I want to save my logs /www/logs/domainname format and WebsiteRoots too. Can I do that?

And lastly Could you add a search input to this forum?

Thank you.
Tony

ServerId = _www
ConnectionsTotal = 1000
ConnectionsPerIP = 25
SystemLogfile = /usr/local/var/log/hiawatha/system.log
GarbageLogfile = /usr/local/var/log/hiawatha/garbage.log


Binding {
Port = 80
# Interface = 127.0.0.1
# MaxKeepAlive = 30
# TimeForRequest = 3,20
}

BanOnGarbage = 150
BanOnMaxPerIP = 25
KickOnBan = yes
RebanDuringBan = yes

CGIhandler = /usr/bin/php-cgi:php

FastCGIserver {
FastCGIid = PHP5
ConnectTo = 127.0.0.1:9000
Extension = php
}

UrlToolkit {
ToolkitID = check_referer
Match \.(css|js|jpg|jpeg|png|gif|bmp|jar|svg|pdf|zip|swf|apk) DenyAccess
Match \.(css|js|jpg|jpeg|png|gif|bmp|jar|svg|pdf|zip|swf|apk)\? DenyAccess
}

UrlToolkit {
ToolkitID = oc

#Cache the image files for 5 years
Match \.(jpg|jpeg|png|gif|bmp|svg) Expire 60 months
Match \.(jpg|jpeg|png|gif|bmp|svg)\? Expire 60 months

#Any foreign referers, check to see if they want an image
Header referer !.*\.dev\.org/.* Call check_referer
}


Hostname = 127.0.0.1
WebsiteRoot = /Library/Webserver/hiawatha
StartFile = index.php
AccessLogfile = /usr/local/var/log/hiawatha/access.log
ErrorLogfile = /usr/local/var/log/hiawatha/error.log
UseFastCGI = PHP5
UseToolkit = oc

VirtualHost {
Hostname = www.bws.com, bws.com
WebsiteRoot = /Applications/MAMP/htdocs/bws
StartFile = index.php
# AccessLogfile = /var/www/bws.com/log/access.log
# ErrorLogfile = /var/www/bws.com/log/error.log
TimeForCGI = 5
UseFastCGI = PHP5
UseToolkit = oc
}


Hiawatha version: 9
Operating System: Testing MacOS / will run CentOS
AxAn
17 March 2015, 08:42
Search forum: https://www.hiawatha-webserver.org/search
Hugo Leisink
17 March 2015, 16:04
Denying a host based on a mismatch between referer and hostname can be done on a per-rule basis, not in one general one. I advice not to trust too much on the referer header. Browser might stop setting this header in the nearby future (due to privacy issues).

About the log, you can use any filename you want. Or what exactly do you mean?

And yes, a search page is available.
Tony
17 March 2015, 20:39
Yes you right thank you for you answer.

I imagine like that.

VirtualHost {
Hostname = bws.com
WebsiteRoot = /Applications/MAMP/htdocs/$Hostname
StartFile = index.php
# AccessLogfile = /var/www/$Hostname/log/access.log
# ErrorLogfile = /var/www/$Hostname/log/error.log
TimeForCGI = 5
UseFastCGI = PHP5
UseToolkit = oc
}
This topic has been closed.