summaryrefslogtreecommitdiff
path: root/http
diff options
context:
space:
mode:
Diffstat (limited to 'http')
-rw-r--r--http/nginx.conf47
-rw-r--r--http/php-fpm.conf36
-rw-r--r--http/php/config.php24
3 files changed, 13 insertions, 94 deletions
diff --git a/http/nginx.conf b/http/nginx.conf
deleted file mode 100644
index ca4c2f4..0000000
--- a/http/nginx.conf
+++ /dev/null
@@ -1,47 +0,0 @@
-user nginx;
-worker_processes auto;
-
-error_log /var/log/nginx/error.log notice;
-pid /run/nginx.pid;
-
-events {
- worker_connections 1024;
-}
-
-http {
- include /etc/nginx/mime.types;
- default_type application/octet-stream;
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- access_log /var/log/nginx/access.log main;
- sendfile on;
- keepalive_timeout 65;
-
- server {
- listen 80;
- listen [::]:80;
- server_name joeac.net;
-
- access_log /var/log/nginx/host.access.log main;
-
- location / {
- root /usr/share/nginx/html;
- try_files $uri $uri.html $uri/index.html $uri.php $uri/index.php =404;
- }
-
- error_page 404 /error.html;
-
- location ~ \.php$ {
- root html;
- fastcgi_pass unix:/run/php8.5-fpm-joeac.net-http.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
- include fastcgi_params;
- }
-
- location ~ /\.sqlite {
- deny all;
- }
- }
-}
diff --git a/http/php-fpm.conf b/http/php-fpm.conf
deleted file mode 100644
index ca71d66..0000000
--- a/http/php-fpm.conf
+++ /dev/null
@@ -1,36 +0,0 @@
-[joeac.net]
-user = nginx
-group = nginx
-listen = /run/php8.5-fpm-joeac.net-http.sock
-listen.owner = nginx
-listen.group = nginx
-listen.mode = 0660
-
-access.log = /var/log/php85/$pool.access.log
-access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{milli}d %{kilo}M %C%%"
-catch_workers_output = yes
-php_admin_value[error_log] = /var/log/php85/$pool.error.log
-php_admin_flag[log_errors] = on
-
-php_admin_value[disable_functions] = exec,passthru,shell_exec,system
-php_admin_flag[allow_url_fopen] = off
-
-pm = dynamic
-pm.max_children = 20
-pm.start_servers = 4
-pm.min_spare_servers = 2
-pm.max_spare_servers = 8
-pm.max_requests = 500
-
-clear_env = no
-env[MAX_DAILY_EMAILS] = $MAX_DAILY_EMAILS
-env[CONTACT_MAILBOX] = $CONTACT_MAILBOX
-env[CONTACT_MAILBOX_NAME] = $CONTACT_MAILBOX_NAME
-env[LOCAL_SMTP_FROM] = $LOCAL_SMTP_FROM
-env[LOCAL_SMTP_FROM_NAME] = $LOCAL_SMTP_FROM_NAME
-env[LOCAL_SMTP_HOST] = $LOCAL_SMTP_HOST
-env[LOCAL_SMTP_PORT] = $LOCAL_SMTP_PORT
-env[LOCAL_SMTP_USER] = $LOCAL_SMTP_USER
-env[LOCAL_SMTP_PASSWORD] = $LOCAL_SMTP_PASSWORD
-env[DB_SCHEME] = $DB_SCHEME
-env[DB_PATH] = $DB_PATH
diff --git a/http/php/config.php b/http/php/config.php
index a83b493..cfe91d3 100644
--- a/http/php/config.php
+++ b/http/php/config.php
@@ -1,8 +1,10 @@
<?php namespace JoeacNet\Http\Config;
+define("CONFIG", parse_ini_file(dirname(__FILE__, 2) . "/config.ini"));
+
function maxDailyEmails(): int|null
{
- $maxDailyEmails = getenv("MAX_DAILY_EMAILS");
+ $maxDailyEmails = CONFIG["MAX_DAILY_EMAILS"];
if (!is_numeric($maxDailyEmails)) {
return null;
}
@@ -11,50 +13,50 @@ function maxDailyEmails(): int|null
function contactMailbox(): string|null
{
- return (string) getenv("CONTACT_MAILBOX");
+ return (string) CONFIG["CONTACT_MAILBOX"];
}
function contactMailboxName(): string|null
{
- return (string) getenv("CONTACT_MAILBOX_NAME");
+ return (string) CONFIG["CONTACT_MAILBOX_NAME"];
}
function localSmtpFrom(): string|null
{
- return (string) getenv("LOCAL_SMTP_FROM");
+ return (string) CONFIG["LOCAL_SMTP_FROM"];
}
function localSmtpFromName(): string|null
{
- return (string) getenv("LOCAL_SMTP_FROM_NAME");
+ return (string) CONFIG["LOCAL_SMTP_FROM_NAME"];
}
function localSmtpHost(): string|null
{
- return (string) getenv("LOCAL_SMTP_HOST");
+ return (string) CONFIG["LOCAL_SMTP_HOST"];
}
function localSmtpPort(): string|null
{
- return (string) getenv("LOCAL_SMTP_PORT");
+ return (string) CONFIG["LOCAL_SMTP_PORT"];
}
function localSmtpUser(): string|null
{
- return (string) getenv("LOCAL_SMTP_USER");
+ return (string) CONFIG["LOCAL_SMTP_USER"];
}
function localSmtpPass(): string|null
{
- return (string) getenv("LOCAL_SMTP_PASSWORD");
+ return (string) CONFIG["LOCAL_SMTP_PASSWORD"];
}
function dbScheme(): string|null
{
- return (string) getenv("DB_SCHEME");
+ return (string) CONFIG["DB_SCHEME"];
}
function dbPath(): string|null
{
- return (string) getenv("DB_PATH");
+ return (string) CONFIG["DB_PATH"];
}