Project

General

Profile

« Previous | Next » 

Revision 6f0d237e

Added by Ermal LUÇI over 12 years ago

Simpligy lighty config and send all lighty logs to syslog rather to a file not readble by anything

View differences:

etc/inc/system.inc
739 739
	if($captive_portal == true)  {
740 740
		$captiveportal = ",\"mod_rewrite\"";
741 741
		$captive_portal_rewrite = "url.rewrite-once = ( \"(.*captiveportal.*)\" => \"$1\", \"(.*)\" => \"/index.php?redirurl=$1\" )\n";
742
		$captive_portal_module = "";
743 742
		$maxprocperip = $config['captiveportal']['maxprocperip'];
744 743
		if($maxprocperip and $maxprocperip > 0)
745 744
			$captive_portal_mod_evasive = "evasive.max-conns-per-ip = {$maxprocperip}";
......
752 751
	} else {
753 752
		$captiveportal = "";
754 753
		$captive_portal_rewrite = "";
755
		$captive_portal_module = "";
756 754
		$captive_portal_mod_evasive = "";
757 755
		$server_upload_dirs = "server.upload-dirs = ( \"{$g['upload_path']}/\", \"{$g['tmp_path']}/\", \"/var/\" )\n";
758 756
		$server_max_request_size = "server.max-request-size    = 2097152";
......
790 788
		}
791 789
	}
792 790

  
793
	if($captive_portal == true)  {	
794
		$bin_environment =  <<<EOC
795
			"bin-environment" => (
796
				"PHP_FCGI_CHILDREN" => "0",
797
				"PHP_FCGI_MAX_REQUESTS" => "500"
798
			),
799
EOC;
800

  
801
	} else if ($avail > 0 and $avail < 128) {
791
	if ($avail > 0 and $avail < 128) {
802 792
		$bin_environment = <<<EOC
803 793
			"bin-environment" => (
804 794
				"PHP_FCGI_CHILDREN" => "0",
......
806 796
			),
807 797

  
808 798
EOC;
799
	} else if ($captive_portal == true)  {	
800
		$bin_environment =  <<<EOC
801
			"bin-environment" => (
802
				"PHP_FCGI_CHILDREN" => "{$max_procs}",
803
				"PHP_FCGI_MAX_REQUESTS" => "500"
804
			),
805
EOC;
806

  
809 807
	} else
810 808
		$bin_environment =  <<<EOC
811 809
			"bin-environment" => (
812
				"PHP_FCGI_CHILDREN" => "0",
810
				"PHP_FCGI_CHILDREN" => "{$max_procs}",
813 811
				"PHP_FCGI_MAX_REQUESTS" => "500"
814 812
			),
815 813
EOC;
816 814

  
817
	if($fast_cgi_enable == true) {
818
		$module = "\"mod_fastcgi\", \"mod_cgi\"";
819
		$cgi_config = "";
820
		$fastcgi_config = <<<EOD
815
	$fastcgi_config = <<<EOD
821 816
#### fastcgi module
822 817
## read fastcgi.txt for more info
823 818
fastcgi.server = ( ".php" =>
......
832 827
	)
833 828
)
834 829

  
835
#### CGI module
836
cgi.assign                 = ( ".cgi" => "" )
837

  
838 830
EOD;
839
	} else {
840
		$fastcgi_config = "";
841
		$module = "\"mod_cgi\"";
842
		$cgi_config = <<<EOD
843
#### CGI module
844
cgi.assign                 = ( ".php"  => "/usr/local/bin/php",
845
                               ".cgi" => "" )
846

  
847
EOD;
848
	}
849 831

  
850 832
	$lighty_config = "";
851 833
	$lighty_config .= <<<EOD
......
861 843
server.network-backend 	= "writev"
862 844

  
863 845
## modules to load
864
server.modules              =   (
865
									{$captive_portal_module}
866
									"mod_access", "mod_accesslog", "mod_expire", "mod_compress", "mod_redirect",
867
									{$module}{$captiveportal}
868
								)
869

  
870
## Unused modules
871
#                               "mod_setenv",
872
#                               "mod_rewrite",
873
#                               "mod_ssi",
874
#                               "mod_usertrack",
875
#                               "mod_expire",
876
#                               "mod_secdownload",
877
#                               "mod_rrdtool",
878
#                               "mod_auth",
879
#                               "mod_status",
880
#                               "mod_alias",
881
#                               "mod_proxy",
882
#                               "mod_simple_vhost",
883
#                               "mod_evhost",
884
#                               "mod_userdir",
885
#                               "mod_cgi",
846
server.modules              =   ( "mod_access", "mod_accesslog", "mod_expire", "mod_compress", "mod_redirect", "mod_fastcgi"
847
			{$captiveportal}
848
		)
886 849

  
887 850
server.max-keep-alive-requests = 15
888 851
server.max-keep-alive-idle = 30
......
896 859
server.max-write-idle = 999
897 860

  
898 861
## where to send error-messages to
899
server.errorlog             = "/var/log/lighttpd.error.log"
862
server.errorlog-use-syslog="enable"
900 863

  
901 864
# files to check for if .../ is requested
902 865
server.indexfiles           = ( "index.php", "index.html",
......
958 921
# Use the "Content-Type" extended attribute to obtain mime type if possible
959 922
#mimetypes.use-xattr        = "enable"
960 923

  
961
#### accesslog module
962
#accesslog.filename          = "/dev/null"
963

  
964 924
## deny access the file-extensions
965 925
#
966 926
# ~    is for backupfiles from vi, emacs, joe, ...
......
968 928
#      of the document-root
969 929
url.access-deny             = ( "~", ".inc" )
970 930

  
971

  
972 931
######### Options that are good to be but not neccesary to be changed #######
973 932

  
974 933
## bind to port (default: 80)
......
1000 959

  
1001 960
{$fastcgi_config}
1002 961

  
1003
{$cgi_config}
1004

  
1005 962
{$captive_portal_mod_evasive}
1006 963

  
1007 964
expire.url = (

Also available in: Unified diff