diff options
Diffstat (limited to 'config')
-rw-r--r-- | config/hex-zero.conf.apache | 23 | ||||
-rw-r--r-- | config/hex-zero.conf.example | 70 |
2 files changed, 93 insertions, 0 deletions
diff --git a/config/hex-zero.conf.apache b/config/hex-zero.conf.apache new file mode 100644 index 0000000..821b7b8 --- /dev/null +++ b/config/hex-zero.conf.apache @@ -0,0 +1,23 @@ +# Apache example config for hex-zero application +<VirtualHost *:80> + + ServerName 0x0.ipa.example.com + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # This reverse proxy definition exists for when you run hex-zero on + # loopback and want to use apache to protect it either with + # authentication or TLS. This hostname and port number must match the + # hex-zero.conf values for APP_HOST_LISTEN and APP_PORT. + # And the hostname and path must match APP_URL from the same file. + ProxyPass /hex-zero http://localhost:3031/ + ProxyPassReverse /hex-zero http://localhost:3031/ + +</VirtualHost> +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/config/hex-zero.conf.example b/config/hex-zero.conf.example new file mode 100644 index 0000000..2e7ffa0 --- /dev/null +++ b/config/hex-zero.conf.example @@ -0,0 +1,70 @@ +# vim: syntax=python +FHOST_STORAGE_PATH = "/var/www/0x0/up" +FHOST_USE_X_ACCEL_REDIRECT = False # use True for nginx +USE_X_SENDFILE = False # supposed to use True when using anything other than nginx, but True fails in my apache2 setup +MAX_CONTENT_LENGTH = 512 * 1024 * 1024 +MAX_URL_LENGTH = 4096 +FHOST_EXT_OVERRIDE = { + "audio/flac" : ".flac", + "image/gif" : ".gif", + "image/jpeg" : ".jpg", + "image/png" : ".png", + "image/svg+xml" : ".svg", + "video/webm" : ".webm", + "video/x-matroska" : ".mkv", + "application/octet-stream" : ".bin", + "text/plain" : ".log", + "text/plain" : ".txt", + "text/x-diff" : ".diff", +} + +# default blacklist to avoid AV mafia extortion +FHOST_MIME_BLACKLIST = [ + "application/x-dosexec", + "application/java-archive", + "application/java-vm" +] + +# template for front page of app +FHOST_FRONTPAGE = "/var/www/0x0/front.html.in" + +ADMIN_EMAIL = "root@d2-03a" +# with this, as well as use this for printing the base url of the app +APP_URL = "http://d2-03a/hex-zero" +# use the forwarded IP address header instead of the requester IP address +USE_HTTP_X_FORWARDED_FOR = True +# If you want to expose this app directly on 0.0.0.0 that is dangerous, but up to you. +APP_HOST_LISTEN = "localhost" +# this must match the apache proxy destination port number +APP_PORT = 3031 + +# modified from example at https://flask.palletsprojects.com/en/1.1.x/logging/ +WSGI_LOGGING = { + 'version': 1, + 'formatters': { + 'default': { + 'format': '%(message)s', + }, + 'verbose': { + 'format': '[%(asctime)s] %(levelname)s in %(module)s: %(message)s' + } + }, + 'handlers': { + 'wsgi': { + 'class': 'logging.StreamHandler', + 'stream': 'ext://flask.logging.wsgi_errors_stream', + 'formatter': 'default' + }, + 'file': { + 'class': 'logging.handlers.RotatingFileHandler', + 'formatter': 'default', + 'filename': '/var/log/hex-zero/hex-zero.log', + 'maxBytes': 314572800, + 'backupCount': 0 + } + }, + 'root': { + 'level': 'INFO', + 'handlers': ['file'] + }, +} |