From 7e4d5c7659e2cc4b842f77eb27192883eb0062a8 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Thu, 12 Jan 2023 13:45:23 -0500
Subject: linhes-system: update defaults for lighttpd, sqlserver and php

---
 linhes/linhes-system/PKGBUILD           | 14 ++++++----
 linhes/linhes-system/lh_lighttpd.conf   | 37 +++++++++++++++++----------
 linhes/linhes-system/lh_php.ini         | 45 +++++++++++++++++++++++++++++++++
 linhes/linhes-system/lh_sqlserver.cnf   | 35 +++++++++++++++++++++++++
 linhes/linhes-system/lh_system_start.sh |  1 +
 5 files changed, 113 insertions(+), 19 deletions(-)
 create mode 100644 linhes/linhes-system/lh_php.ini

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index 1c9026c..c2d8499 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=21
+pkgrel=23
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -17,7 +17,7 @@ source=($binfiles
     'myth_mtc.cron' 'paccache.cron' 'xfs_defrag.cron'
     'readme_is_xml' 'add_storage.readme'
     '79-cronie.hook' 'fstrim.hook' 'openssh.hook'
-    '10-monitor.conf' 'x11vnc.override.conf' 'lh_lighttpd.conf'
+    '10-monitor.conf' 'x11vnc.override.conf' 'lh_lighttpd.conf' 'lh_php.ini'
     'system-sudo.rules' 'linhes-profile.sh' 'lh_sqlserver.cnf'
     'lh_system_start.sh.desktop')
 sha256sums=('7f91d2afcb76e8e9063c6bbe05f5c3d134a6f67541aead8894d342c32d34ad98'
@@ -27,7 +27,7 @@ sha256sums=('7f91d2afcb76e8e9063c6bbe05f5c3d134a6f67541aead8894d342c32d34ad98'
             '11168c9cd3b117decaab6bc665c183b4aab917cf0a976bce4c1b5e4686a27bc9'
             'ae34515e144830f424d3bd3f6b1b446892d62beed20bca6f0fb19b0bbb779f27'
             '23358a7bff4968eccd469613b81b1415c2ae0ebe77f14f74426697333e4d88d7'
-            '938b8929fed2934684d9d58652a03e3fe4f5cbdd461b11ac8904bda30ee0eb76'
+            '5bed6be9b84c71df297739357d4af16b0674a4bd6dfc263d94f08d1eb982dd74'
             '6d4fb0ed1a5ed961b3a3884dce093118e50c2981a9cd5837d20abc5a6d4fd8aa'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9'
@@ -48,10 +48,11 @@ sha256sums=('7f91d2afcb76e8e9063c6bbe05f5c3d134a6f67541aead8894d342c32d34ad98'
             '890482242434e333024c7819e8bf3c889dc16548d0a1745479c8523930fb32f7'
             'dead17906b33a7f9d66ad13bb1c083a23438f45ece9bd5ec41ff86eda01c132a'
             '2c9152ed542bb9c3aa516c6009125a757065100a060e0fa597243d4cbd92844f'
-            '2523c92128f52ad1e7fd291ddbfd3c0396f37115dabc5cf6828a0d21b99a667b'
+            '73aae13c47223c4ebb45c5cb2aff19a72b6b32cc0d9e7c83de9f97ada593b411'
+            'd4e37e72854edcba76b5464617bea3826e0495f9788340aa318d5f3cf29e87a2'
             'a9d0a94ff442453f0bec0b2e8afd591cf17b2845b6ae45ff300530114efd30af'
             '47ace62d7e7e651f25dc7c0a2e96d0862f5efe1a583eeda2843b1fc1499141fe'
-            '4b89eb5aeb6ea8f0be5fd16cae3c2536114dfb0b594c64e9f44e7c2394079e7e'
+            '3ed91fb5a7894f82fb4895e06d2e3f1df3ac4f82e46c970d4a85aaa4edc24cf1'
             '0b9868a563036c81f8fdb8ab8bbad51934aca2a07e9d7634e24214791afda8e2')
 
 package() {
@@ -77,6 +78,9 @@ package() {
     #sql files
     install -Dm644 $srcdir/lh_sqlserver.cnf $pkgdir/etc/my.cnf.d/lh_sqlserver.cnf
 
+    #php files
+    install -Dm644 $srcdir/lh_php.ini $pkgdir/etc/php/conf.d/lh_php.ini
+
     #lighttpd files
     install -Dm644 $srcdir/lh_lighttpd.conf $pkgdir/etc/lighttpd/conf.d/lh_lighttpd.conf
 
diff --git a/linhes/linhes-system/lh_lighttpd.conf b/linhes/linhes-system/lh_lighttpd.conf
index d339a9b..1831925 100644
--- a/linhes/linhes-system/lh_lighttpd.conf
+++ b/linhes/linhes-system/lh_lighttpd.conf
@@ -8,41 +8,41 @@
 # - saves some time
 # - saves memory
 server.modules              = (
-                            "mod_rewrite",
+                                "mod_rewrite",
 #                               "mod_redirect",
-                            "mod_alias",
-                            "mod_access",
+                                "mod_alias",
+                                "mod_access",
 #                               "mod_cml",
 #                               "mod_trigger_b4_dl",
-                            "mod_auth",
-                            "mod_status",
-                            "mod_setenv",
-                            "mod_fastcgi",
-                            "mod_proxy",
+                                "mod_auth",
+                                "mod_status",
+                                "mod_setenv",
+                                "mod_fastcgi",
+                                "mod_proxy",
 #                               "mod_simple_vhost",
 #                               "mod_evhost",
 #                               "mod_userdir",
-                            "mod_cgi",
+                                "mod_cgi",
 #                               "mod_compress",
-                            "mod_ssi",
+                                "mod_ssi",
 #                               "mod_usertrack",
 #                               "mod_expire",
 #                               "mod_secdownload",
 #                               "mod_rrdtool",
-                            "mod_accesslog" )
+                                "mod_accesslog" )
 
 ## a static document-root, for virtual-hosting take look at the
 ## server.virtual-* options
 server.document-root        = "/data/srv/httpd/htdocs"
 
 ## where to send error-messages to
-#server.errorlog             = "/var/log/lighttpd/error.log"
+server.errorlog             = "/var/log/lighttpd/error.log"
 #### accesslog module
 #accesslog.filename          = "/var/log/lighttpd/access.log"
 
 ##send errors to syslog
-server.errorlog-use-syslog      = "enable"
-$HTTP["url"] !~ "\.(jpe?g|png|gif|css)" { accesslog.use-syslog = "enable" }
+#server.errorlog-use-syslog      = "enable"
+#$HTTP["url"] !~ "\.(jpe?g|png|gif|css)" { accesslog.use-syslog = "enable" }
 
 ## File uploads
 # Make sure this folder exists and is writable to server.username
@@ -268,3 +268,12 @@ $HTTP["url"] =~ "^/cgi-bin" {
 #include_shell "echo var.a=1"
 ## the above is same as:
 #var.a=1
+
+alias.url += ( "/mythweb" => "/data/srv/httpd/mythweb/")
+
+url.rewrite-once = (
+"^/{1,2}mythweb/(css|data|images|js|themes|skins|[a-z_]+\.(php|pl)).*" => "$0",
+"^/{1,2}mythweb/(pl(/.*)?)$" => "/mythweb/mythweb.pl/$1",
+"^/{1,2}mythweb/(.+)$"       => "/mythweb/mythweb.php/$1",
+"^/{1,2}mythweb/(.*)$"       => "/mythweb/mythweb.php"
+)
diff --git a/linhes/linhes-system/lh_php.ini b/linhes/linhes-system/lh_php.ini
new file mode 100644
index 0000000..521f2f3
--- /dev/null
+++ b/linhes/linhes-system/lh_php.ini
@@ -0,0 +1,45 @@
+[PHP]
+
+; Log errors to specified file. PHP's default behavior is to leave this value
+; empty.
+; http://php.net/error-log
+; Example:
+;error_log = php_errors.log
+; Log errors to syslog (Event Log on Windows).
+;error_log = syslog
+
+; How many GET/POST/COOKIE input variables may be accepted
+max_input_vars = 6000
+
+; This directive determines whether or not PHP will recognize code between
+; <? and ?> tags as PHP source which should be processed as such. It is
+; generally recommended that <?php and ?> should be used and that this feature
+; should be disabled, as enabling it may result in issues when generating XML
+; documents, however this remains supported for backward compatibility reasons.
+; Note that this directive does not control the <?= shorthand tag, which can be
+; used regardless of this directive.
+; Default Value: On
+; Development Value: Off
+; Production Value: Off
+; http://php.net/short-open-tag
+short_open_tag = On
+
+; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
+; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
+; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
+; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
+; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
+; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
+; http://php.net/cgi.fix-pathinfo
+cgi.fix_pathinfo=1
+
+extension=ftp.so
+extension=gd.so
+extension=gettext.so
+extension=mcrypt.so
+extension=mysql.so
+extension=mysqli.so
+extension=openssl.so
+extension=pdo_mysql.so
+extension=sockets.so
+extension=zip.so
diff --git a/linhes/linhes-system/lh_sqlserver.cnf b/linhes/linhes-system/lh_sqlserver.cnf
index 1850f8e..be2d5bd 100644
--- a/linhes/linhes-system/lh_sqlserver.cnf
+++ b/linhes/linhes-system/lh_sqlserver.cnf
@@ -40,6 +40,41 @@
 [mariadb]
 datadir=/data/srv/mysql
 
+skip-external-locking
+
+net_buffer_length = 8K
+key_buffer_size = 768M
+max_allowed_packet = 1M
+tmp_table_size = 256M
+max_heap_table_size = 256M
+sort_buffer_size = 2M
+read_buffer_size = 2M
+read_rnd_buffer_size = 2M
+myisam_sort_buffer_size = 64M
+thread_cache_size = 8
+query_cache_type = 0
+query_cache_size = 0
+query_cache_limit = 2M
+join_buffer_size = 1M
+ignore-db-dir = lost+found
+table_open_cache = 5000
+open_files_limit = 10000
+
+# Uncomment the following if you are using InnoDB tables
+#innodb_data_home_dir = /var/lib/mysql
+#innodb_data_file_path = ibdata1:10M:autoextend
+#innodb_log_group_home_dir = /var/lib/mysql
+# You can set .._buffer_pool_size up to 50 - 80 %
+# of RAM but beware of setting memory usage too high
+#innodb_buffer_pool_size = 16M
+#innodb_additional_mem_pool_size = 2M
+# Set .._log_file_size to 25 % of buffer pool size
+innodb_log_file_size = 16M
+#innodb_log_buffer_size = 8M
+#innodb_flush_log_at_trx_commit = 1
+#innodb_lock_wait_timeout = 50
+innodb_buffer_pool_instances = 1
+
 # This group is only read by MariaDB-10.8 servers.
 # If you use the same .cnf file for MariaDB of different versions,
 # use this group for options that older servers don't understand
diff --git a/linhes/linhes-system/lh_system_start.sh b/linhes/linhes-system/lh_system_start.sh
index d51f603..995ccde 100755
--- a/linhes/linhes-system/lh_system_start.sh
+++ b/linhes/linhes-system/lh_system_start.sh
@@ -84,6 +84,7 @@ function sql_setup(){
 
 function localweb_setup(){
     sudo pacman -Syyy --noconfirm linhes-web
+    sudo cp /etc/lighttpd/lighttpd.conf /etc/lighttpd/lighttpd.conf.orig
     sudo cp /usr/share/linhes/templates/lighttpd.conf.template /etc/lighttpd/lighttpd.conf
     sudo systemctl enable --now lighttpd.service
 }
-- 
cgit v0.12

