Giter Site home page Giter Site logo

troglobit / merecat Goto Github PK

View Code? Open in Web Editor NEW
141.0 14.0 19.0 1.37 MB

Small and made-easy HTTP/HTTPS server based on Jef Poskanzer's thttpd

Home Page: https://troglobit.com/projects/merecat/

License: BSD 2-Clause "Simplified" License

Makefile 1.07% Shell 0.60% M4 1.59% C 79.38% HTML 16.09% CSS 0.66% Perl 0.19% Dockerfile 0.14% PHP 0.01% Python 0.26%
thttpd virtual-hosts httpd embedded cgi https http-server ssl tls http-redirect

merecat's Introduction

Merecat httpd ∴ Embedded Web Server

License Badge GitHub Status Coverity Status

http://imgur.com/user/SunShot

Merecat started out as a pun at Mongoose, but is now useful for actual web serving purposes. It is however not a real Meerkat, merely yet another copycat, forked from the great thttpd created by Jef Poskanzer.

Merecat httpd expands on the features originally offered by thttpd, but still has a limited feature set:

  • Virtual hosts
  • Basic .htpassd and .htaccess support
  • URL-traffic-based throttling
  • CGI/1.1
  • HTTP/1.1 Keep-alive
  • Built-in gzip deflate using zlib
  • HTTPS support using OpenSSL/LibreSSL, works with Let's Encrypt!
  • Dual server support, both HTTP/HTTPS from one process
  • HTTP redirect, to gently redirect from HTTP server to HTTPS
  • Native PHP support, using php-cgi if enabled in merecat.conf

The resulting footprint (~140 kiB) makes it quick and suitable for small and embedded systems!

Merecat is available as free/open source software under the simplified 2-clause BSD license. For more information, see the manual page merecat(8), or the FAQ.

The rest of this README covers some basic functions and recommendations. For more in-depth use-case examples, see the following HowTos:

Docker

Try out Docker Merecat safely isolated from the rest of the system, with easy deployment.

Authentication

To protect a directory in your ~USERNAME/public_html/, create the file .htpasswd using the included htpasswd tool:

user@example:~/> cd public_html/Downloads
user@example:~/public_html/Downloads/> htpasswd -c .htpasswd friend
Changing password for user friend
New password: *****
Re-type new password: *****

Enable this feature, and user home directories, with the configure script. See more on this in the Features section below.

Virtual Hosts

Setting up virtual hosts on a server can be a bit of a hassle with other web servers. With Merecat you simply create directories for each host in the web server root:

/var/www/
  |-- icons/
  |-- cgi-bin/
  |-- errors/
  |    `-- err404.html
  |-- ftp.example.com/
   `- www.example.com/

Edit /etc/merecat.conf:

virtual-host = true
cgi "/cgi-bin/*|**.cgi" {
    enabled = true
}

Now the web server root, /var/www/, no longer serves files, only virtual host directories do, execpt for the shared files in icons/, cgi-bin/, and errors/.

On Linux bind mounts can be used to set up FTP and web access to the same files. Example /etc/fstab:

/srv/ftp  /var/www/ftp.example.com  none  defaults,bind  0  0

Optimizing Performance

There are many tricks to optimizing the performance of your web server. One of the most important ones is browser caching. Merecat supports both ETag: and Cache-Control:, however to enable the latter you need to define the max-age setting in /etc/merecat.conf:

max-age = 3600        # One hour

The value is completely site dependent. For an embedded system you might want to set it to the maximum value, whereas for other scenarios you will likely want something else. By default this is disabled (0).

Another trick is to employ gzip compression. Merecat has built-in support for serving HTML, CSS, and other text/* files if there is a .gz version of the same file. Here is an example of how to compress relevant files:

root@example:~/> cd /var/www/
root@example:/var/www/> for file in `find . -name '*.html' -o -name '*.css'`; do \
      gzip -c $file > $file.gz; done

This approach is more CPU friendly than letting Merecat "deflate" files on the fly, which it otherwise does.

HTTPS Support

If configure finds OpenSSL installed, HTTPS support is enabled, this can be disabled using --without-ssl. However, to gain access to the SSL/TLS settings you also need support for merecat.conf, so you must install libConfuse. See below for all Build Requirements.

The HTTPS support has SSLv2, SSLv3, and TLSv1 disabled (hard coded) by default. Only TLSv2 and later will be enabled and negotiated on a per client basis.

To set up Merecat for HTTPS the following /etc/merecat.conf settings must be enabled:

server secure {
    port = 443
    ssl {
        certfile = /etc/letsencrypt/live/example.com/fullchain.pem
        keyfile  = /etc/letsencrypt/live/example.com/privkey.pem
        dhfile   = /etc/letsencrypt/live/example.com/dhparam.pem
    }
}

Let's Encrypt

Merecat fully supports Let's Encrypt certificates, including HTTP-01 renewals. Use the server location directive:

server default {
        port = 80
        location "/.well-known/acme-challenge/**" {
                 path = "letsencrypt/.well-known/acme-challenge/"
        }
        redirect "/**" {
                 code = 301
                 location = "https://$host$request_uri$args"
        }
}

The path must be relative to the server root directory. Use bind mounts to get /var/lib/letsencrypt into your server root. This way we can ensure certbot only writes to its own directory and cannot write to any file in the server root.

Then run certbot with the following arguments and then add all virtual hosts you want to support from Merecat:

root@example:/var/www/> certbot certonly --webroot --webroot-path /var/lib/letsencrypt

For a HowTo see:

Self-signed Certificate

To create a self signed certificate and enable perfect forward secrecy, PFS, i.e. Diffie-Helman paramters (optional), use the openssl tool as shown below. Notice the use of a sub-shell with openssl.cnf where most of the certificate settings are, and more importantly notice the use of subjectAltName, or SAN. The latter is required by most browsers today.

root@example:/var/www/> mkdir private certs
root@example:/var/www/> openssl req -x509 -newkey rsa:4096 -nodes    \
            -keyout private/server.key -new -out certs/server.pem    \
            -subj /CN=www.acme.com -reqexts SAN -extensions SAN      \
            -sha256 -days 3650 -config <(cat /etc/ssl/openssl.cnf    \
             <(printf '[SAN]\nsubjectAltName=DNS:www.acme.com'))
root@example:/var/www/> openssl dhparam -out certs/dhparm.pem 4096

HTTP Redirect

For a setup with two servers, the following example can be used to run HTTPS on port 4443, HTTP on port 8080 and redirect to the HTTPS server on any access:

server secure {
    port     = 4443
    ssl {
        certfile = certs/server.pem
        keyfile  = private/server.key
        dhfile   = certs/dhparm.pem
    }
}

server default {
    port = 8080
    redirect "/**" {
        code = 303
        location = "https://$host:4443$request_uri$args"
    }
}

Supported HTTP redirect codes are: 301, 302, 303, and 307.

The location setting supports three nginx style variables as shown in the example. Please note the quotes around the pattern, or the .conf parser will think the pattern is a C-style comment.

Build Requirements

Merecat depends on a few external libraries, if enabled, e.g. OpenSSL, zlib, and libConfuse. On Debian/Ubuntu systems you can install the dependencies with:

user@example:~/> sudo apt install pkg-config libconfuse-dev libssl-dev zlib1g-dev

If you build the deps. from source, they may default to use an install prefix of /usr/local. Non Debian/Ubuntu systems rarely support this GNU standard, so here is how you reference it for the Merecat configure script:

user@example:~/merecat/> PKG_CONFIG_LIBDIR=/usr/local/lib/pkgconfig ./configure

To build Merecat without support for /etc/merecat.conf:

user@example:~/merecat/> ./configure --without-config

If you build from GIT sources and not a released tarball, then remember:

user@example:~/merecat/> ./autogen.sh

To install httpd into /usr/sbin/, default index and icons into /var/www, and config file to /etc/merecat.conf:

user@example:~/merecat/> ./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
user@example:~/merecat/> make
user@example:~/merecat/> sudo make install

Cross compiling Merecat for an another target is possible by setting the --host flag to the configure script. This is well documented in the GNU Documentation. Note: ususally the --build system is automatically detected.

Merecat builds are silent by default. For detailed compiler output, disable silent mode with configure --disable-silent-rules, or build with make V=1.

Features

Merecat consists of a front-end, merecat.c, and a standalone HTTP library, libhttpd.c, which can be tweaked in various ways and used for embedding a web server in another application if needed.

The most common options are available from the merecat command line and the merecat.conf configuration file. Other, less common options, can be enabled using the configure script:

--enable-builtin-icons  Enable built-in icons for dir listings
--enable-htaccess       Enable .htaccess files for access control
--enable-htpasswd       Enable .htpasswd files for authentication
--enable-public-html    Enable $HOME/public_html as ~USERNAME/
--enable-msie-padding   Add padding to error messages for Internet Explorer
--disable-dirlisting    Disable directory listings when no index file is found
--without-config        Disable /etc/merecat.conf support using libConfuse
--without-ssl           Disable HTTPS support, default: enabled
--without-symlinks      Disable httpd and in.httpd symlinks to merecat
--without-zlib          Disable mod_deflate (gzip) using zlib

The source file merecat.h has even more features that can be tweaked, some of those are mentioned in the man page, but the header file has very useful comments as well.

Origin & References

Merecat is a stiched up fork of sthttpd with lots of lost patches found lying around the web. The sthttpd project in turn is a fork from the original thttpd -- the tiny/turbo/throttling HTTP server.

merecat's People

Contributors

alephnull avatar blueness avatar ciz avatar jirutka avatar jpouellet avatar marcosfrm avatar mmcco avatar philbudne avatar rdtennent avatar stappersg avatar troglobit avatar vojta7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

merecat's Issues

SSL file upload

Hi,
I had build meracat on current arch linux and it seems to be working well. But when I try to upload file with ssl enabled I receive only random mess of data with no boundary. To me it looks like it did not get deciphered or it is compressed. If i disable ssl everything works fine.

I tried to dig into source code, but I am unable to find where it gets messed up. Could you please point me to right direction where to look or help me to solve this problem.

Thanks for your time.
Vojta

Skip doc installation

There must be possible to skip doc installation.
I'm trying to build rpm for Fedora Linux. It packs documentation and licenses with its own commands:

%files
%license LICENSE
%doc README.md ChangeLog.md

So I have to delete installed /usr/share/doc/merecat/LICENSE during packaging because
Extra file[s] installed but not packed: /usr/share/doc/merecat/LICENSE
Other 2 doc files are installing into the same folder as rpmbuild uses, but it its coincidence and unreliably.

can't configure

./configure: line 5849: syntax error near unexpected token confuse,' ./configure: line 5849: PKG_CHECK_MODULES(confuse, libconfuse >= 2.7)'

access.log

I am having a hard time to get a log file of users of the web service, am I just not finding the documentation?

help me enable PHP

This is my configuration, I installed php and php-cgi, but I couldn't enable php, it doesn't run the example script phpinfo.php, it just shows plain text of php code:


directory = /var/www
data-directory = /htdocs/php_test
charset = "UTF-8"
chroot = true
compression-level = -1
global-passwd = false
hostname = 127.0.0.1
list-dotfiles = false

#virtual-host = true

#sudo pacman -S php php-cgi

php "**.php" {
        enabled = true
        cgi-path = "/usr/bin/php-cgi"
}


server php_test_server {
        port = 80
}

2 processes start?

Excellent program thank you - just installed in Bookworm via apt (lazy). I put index.html in /var/www and type merecat.

It mostly works with occasional 500 errros - I think the issue is that when I look, there are 2 running merecat processes
nobody 1088 1 0 18:35 ? 00:00:00 /usr/sbin/merecat -sn /var/www
nobody 1090 1 0 18:35 ? 00:00:00 merecat

If I kill process 1090 then everything works reliably with no more 500's. I've looked at the man page but don't see any switch which tells me what I'm doing wrong (I know it's me...)

Thanks

mbedtls support?

civetweb added mbedtls support, can merecat do the same? Thanks.

make dist; make check fails: fatal: making test-suite.log: failed to create php.trs

Hi,

After creating a tarball from a fresh git checkout with 'make distcheck', unpacking that tarball and running "make check", the
tests fail with

fatal: making test-suite.log: failed to create php.trs
fatal: making test-suite.log: failed to create php.log
make[4]: *** [Makefile:487: test-suite.log] Error 1

This is likely due to tests/php.sh not being included in the tarball. I believe this could be fixed by adding
php.sh to EXTRA_DIST in tests/Makefile.am.

Thanks!

Bye, Joost

Could not run CGI via merecat.conf

merecat.conf:

charset = "UTF-8"
chroot = false
directory = "www"
#data-directory = "db"
global-passwd = false
port = 8080

cgi "list-todos.cgi|list-todos-as-json.cgi" {
	enabled = true
}

Then I tried this:

$ # first terminal
$ merecat -n -f ./merecat.conf 
merecat[147080]: Merecat httpd 2.32-rc4 starting on port: 8080, vhost: OFF, ssl: OFF, php: OFF, ssi: OFF

$ # second terminal
$ curl -I localhost:8080/list-todos.cgi
HTTP/1.1 403 Forbidden
Date: Wed, 03 Jan 2024 09:55:17 GMT
Server: merecat/2.32-rc4
Last-Modified: Wed, 03 Jan 2024 09:55:17 GMT
Accept-Ranges: bytes
Content-Type: text/html; charset=UTF-8
Cache-Control: no-cache,no-store
Cache-Control: no-cache,no-stored
Connection: close

OBTW

$ merecat -h
Usage: merecat [OPTIONS] [WEBROOT]

  -f FILE    Configuration file, default: /etc/merecat.conf
  -h         This help text
  -I IDENT   Identity for syslog, .conf, and PID file, default: merecat
  -l LEVEL   Set log level: none, err, warning, notice*, info, debug
  -n         Run in foreground, do not detach from controlling terminal
  -p PORT    Port to listen to, default 80, or 443 if HTTPS is enabled
  -P PIDFN   Path to PID file, default: /usr/share/merecat-git/run/merecat.pid
  -s         Log to syslog, even though running in foreground, -n
  -t FILE    Throttle file
  -V         Show Merecat httpd version

*) Default log level

Bug report address: https://github.com/troglobit/merecat/issues

Did you intentionally dropped the feature?

Compile options for Raspberry Pi

Hi,

I'm trying to run Merecat on a Raspberry Pi nano to host a hugo site.
Following you instructions on Github, I compiled Merecat and installed it into /usr/sbin. Then after setting up merecat.conf to use HTTPS and HTTP. I ran Merecat using systemctl.

The only problem that I am finding with Merecat is that it is taking up 100% CPU on the Raspberry Pi nano. Is there any compile options that could be used to optimize Merecat for Raspberry PI?

Thanks in advance for any help that you can provide.

Bug in background

When you use Merecat as a background program and send an http request with the post method from the client, Merecat responds with an empty request, in the foreground this does not happen and works fine, only if Merecat is running in the background.

merecat cgi and php?

Hi Everybody,

Managed to build merecat on Ubuntu 16.04, it builds and runs but it wont process php script files since it

have impossible to set path for php-cgi interpreter directory.
I have put the php-cgi executable binary in cgi-bin directory

I will like to use it along with PHP and other CGI executable/interpreters. Many thanks!

Please help: pointers, directions, examples on how I might achieve this.

Hear from you soon!

God blesses!!!

Best regards,
Sanyaade

build time issues with php support

Hi,

I just tried to build merecat Merecat httpd 2.32-rc4 as it sits in git today, on a Debian oldstable 10/buster system.
I don't have php-cgi installed. I tried to build a Debian package from it: I invoked 'debuild' from the merecat
git checkout. It failed with:

make[3]: Entering directory '/home/joostvb/git-ro/merecat/tests'
/usr/bin/make  check-TESTS
make[4]: Entering directory '/home/joostvb/git-ro/merecat/tests'
make[5]: Entering directory '/home/joostvb/git-ro/merecat/tests'
PASS: start.sh
PASS: cgi.sh
FAIL: php.sh
PASS: gzip.sh
PASS: redirect.sh
PASS: location.sh
PASS: stop.sh
============================================================================
Testsuite summary for Merecat httpd 2.32-rc4
============================================================================
# TOTAL: 7
# PASS:  6
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See tests/test-suite.log
Please report to https://github.com/troglobit/merecat/issues
============================================================================
make[5]: *** [Makefile:486: test-suite.log] Error 1

.

test-suite.log has:

FAIL: php
=========

+ echo <?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?>
+ ls srv
cgi-bin
img
index.html
index.html.gz
main.css
main.css.gz
test.php
+ cat srv/test.php
<?php echo 'Hello ' . htmlspecialchars($_GET["name"]) . '!'; ?>
+ + curl http://localhost:8086/test.php?name=foobar
grep Hello foobar
FAIL php.sh (exit status: 1)

It would be nice if in debian/control, the line

Build-Depends: debhelper (>= 10), systemd, pkg-config, libconfuse-dev, libssl-dev, zlib1g-dev

could be replaced with

Build-Depends: debhelper (>= 10), systemd, pkg-config, libconfuse-dev, libssl-dev, zlib1g-dev, php7.4-cgi | php-cgi

(I didn't test that, btw). Furthermore, it'd be nice if ./configure honoured a --disable-php flag.

Thanks for maintaining merecat!

Bye,

Joost

HTTP header line endings

Hi,

I recently discovered the merecat is sending an HTTP response in the following format:

HTTP/1.0 200 OK\r\n
Content-type: text/html\n
\n

The status line is correctly ended with '\r\n', but the content-type header and the newline separating headers and body is '\n'. The Unix line endings are produced by my CGI script. I can fix this on the CGI script side, but accord to CGI RFC it seems that CGI servers are supposed to do the translation from native line ends to '\r\n'.

I think that it can be implemented in libhttp.c when interposing cgi_output after the test that headers aren't empty. Would you be willing to add this change? If necessary I can implement it and send PR.

CGI scripts, specifically cgit

I am trying to get cgit to be served by merecat and have come up against this bug. I do not fully understand CGI and PATH_INFO but I did track down an old patch for thttpd which seems relevant. However, I cannot figure out if this patch has been applied as it cannot be applied in its current form.

I'd be happy to provide any other information to help debug this.

Related to cross compilation

Again disturbed,
Its configure does not support the use of CC variables to specify the cross toolchain;
The following error occurred with the --host=arm-linux CC=arm-linux-ggc command:

checking for arm-linux-pkg-config... no
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for arm-linux-gcc... arm-linux-gcc
checking whether the C compiler works... no
configure: error: in /home/book/merecat-master': configure: error: C compiler cannot create executables See config.log' for more details

http logging doesn't seem complete, even w/ -l debug

Hi there!

Building from the current master (as of this note's timestamp)
Linux xxx.net 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64 GNU/Linux

The build worked fine, new package was created and installed.

merecat -V
2.32-rc4

Seems to operate well enough from a browser's view with a minimal port-80 initial test install, except for the traffic logging only seems to show errors like 304 and 404 best I can tell, even when started with

merecat -n -f /etc/merecat.conf -l debug

(all messages to stdout, right?)

with /etc/merecat.conf containing only:

username = www-data
directory = /var/www

Your default merecat webpage content is in /var/www and displays correctly, but the only logging I can see is the process start-up info, the http 404s and the 304s - no 200s.

Further (another bug report?) the man page indicates CLI -r and -d options, neither of which works or appears in the merecat -h usage message, as well as some of the other merecat(8) listed options (still on the todo list?)

Lastly, why is it that the newly built deb package that builds from my updated/cloned repo indicates install files with modify dates of "July 7, 2020" on all of the installed files? The 'dpkg-deb --contents' of the new deb file shows the same. Odd that, even after a "make distclean", ./autoconf.sh, ./configure, make package sequence, the resulting installed files in /usr/sbin/merecat are dated July 7, 2020. Is there a forced date in the package build rules (I'm not too savvy about pkg building)?

But thanks for keeping this little gem alive (I've been using thttpd for years now, but it's time for me to upgrade..., and your updates tie it all up very nicely - ssl, etc.)

I hope this info helps, and I can test further if it will help.

cheers,
mindsong

Setting environment variable for CGI

I am attempting to get merecat server git-http-backend over CGI. I need to set an environment variable, GIT_PROJECT_ROOT. I attempted setting up an override:

$ cat /lib/systemd/system/merecat.service.d/10-git.conf
[Service]
EnvironmentFile=/var/www/git.alephnull.site/env
$ cat /var/www/git.alephnull.site/env
GIT_PROJECT_ROOT=/srv/repos
GIT_HTTP_EXPORT_ALL=1

This seems to have set the environment vars correctly:

$  sudo cat /proc/$(pgrep merecat)/environ | tr '\0' '\n'
LANG=en_IN
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INVOCATION_ID=12fd140812c6464aa486e89c7b5cf93e
JOURNAL_STREAM=9:1042993
GIT_PROJECT_ROOT=/srv/repos
GIT_HTTP_EXPORT_ALL=1

However, going to http://git.alephnull.site/cgi-bin/printenv does not show me those variables.

Allow cross origin header

Hi,

thank you for this great piece of software. I need to add the Access-Control-Allow-Origin header to the response headers and i just can't figure out how to do it.

Could you please help me ?

Thank you very much

libconfuse2

configure: error: Package requirements (libconfuse >= 2.7) were not met:

No package 'libconfuse' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables confuse_CFLAGS
and confuse_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

---- my system is ubuntu 18.04

dpkg -l |grep confuse
ii libconfuse-common 3.2.1+dfsg-4ubuntu0.1 all Common files for libConfuse
ii libconfuse-dev:amd64 3.2.1+dfsg-4ubuntu0.1 amd64 Development files for libConfuse
ii libconfuse-doc 3.2.1+dfsg-4ubuntu0.1 all Documentation for libConfuse
ii libconfuse2:amd64 3.2.1+dfsg-4ubuntu0.1 amd64 Library for parsing configuration files

Performance issues ?

Hi !

I've been using merecat for a community managed server that serves multiple vhosts : http://bebou.netlib.re
Easy to setup, everything works great except we've been having some strange performance issues. I'm having a lot of trouble understanding what's happening.

The symptoms and what I know :

  • A few KB of data take more than one second to download. For example http://arthur.bebou.netlib.re might take 1.5 seconds to load even though it is a fairly lightweight page.
  • When someones streams audio from http://doublezip.bebou.netlib.re/ htop shows merecat using 100% of one of the servers CPU.
  • On http://doublezip.bebou.netlib.re the video dj.webm, by far the largest element in the page, loads almost instantly but the far smaller html document loads in more than one second.
  • While audio is streamed it is almost impossible to access other resources.
  • RAM usage is fine
  • When tested with busybox's httpd everything works fine, pages load instantly and streaming audio uses a minuscule amount of CPU. But I want vhosts :(
  • pretty much nothing else is happening on the server other than from serving web pages
  • running merecat not chrooted and serving a single host doesn't change anything

My setup :

  • raspberry 3b running up-to date raspberry os
  • merecat installed via debian packages
  • great internet connection, can't be the problem
  • client side tests done in up-to date firefox and chromium packaged by debian
  • merecat launched with systemctl start merecat.service, everything looks right in journalctl

I'm having trouble understanding what's happening and I'm not sure how to effectively troubleshoot on the server. It feels like merecat or something on the server imposes an arbitrary ~1.2 seconds delay to a bunch of resources. I may very well be missing something obvious.

Thank you for your time, have a nice day :)

My merecat config :

## /etc/merecat.conf                                     -*-conf-unix-*-
## This is a sample configuration file for Merecat httpd
## For more help and more settings, see merecat.conf(5).
##

## what interface to bind to?
## (default is binding to any interface)
#hostname=www.example.org

## Port to listen to, overrides command line argument
## Defaults to 80, or 443 when enabling HTTPS
port = 80

## Unpriviliged user to run as, usually nobody or www-data
#username = nobody

## Global .htpasswd (true) or local per-directory (false)
#global-passwd = false

## Chrooting is a security measure which means isolating the webserver's
## access to files only available from a the given directory.  To access
## files outside the chroot the administrator can either copy or bind
## mount files and directories into the chroot.
chroot = true

## Only useful if not chrooting
#check-symlinks = false

## Alt. charset=iso-8859-1
charset = UTF-8

## Deflate (gzip) compression level: -1 .. 9
## -1: Default (zlib's reasonable default, currently 6)
##  0: Disabled
##  1: Best speed
##  9: Best compression
#compression-level = -1

## Webserver document root, or chroot
directory = /var/www

## When chrooting, alt. document root inside chroot
## => /var/www/htdocs
# data-directory = htdocs

## Skip dotfiles in dirlistings
#list-dotfiles = false

## Virtual hosting
## /var/www/cgi-bin/          <-- Shared CGI
## /var/www/meso.bebou.netlib.re
virtual-host = true

## Control the caching, in seconds, by setting the following header for
## all transactions.  Depends heavily on the content you provide, and
## this global setting is disabled by default.  It is recommended to
## instead set it per server location, e.g. for all image files.
##
##    Cache-Control: max-age=SEC
##
## Min max-age value 0 (browser caching disabled)
## Max max-age value 31536000 (1 year)
##
max-age = 3600

## Some bots behave really badly and may overload your server.  Often
## they cannot be blocked based on IP address, so the only means we are
## left with is User-Agent blocking.  Use patterns like this:
#user-agent-deny = "**SemrushBot**|**MJ12bot**|**DotBot**|**PetalBot**"

## Enable HTTPS support.  The certificate (public) and key (private) are
## required when enabling HTTPS support.  The (min) protocol and cipher
## settings are optional and have sane built-in defaults, e.g. 'protocol'
## defaults to TLSv1.1.  See ciphers(1) man page for possible values.
##
## Note: You may want to enable this on a per-server basis instead.
#ssl {
#    protocol = "TLSv1.1"
#    ciphers  = "..."
#    certfile = certs/cert.pem
#    keyfile  = private/key.pem
#    dhfile   = certs/dhparam.pem
#}

## The CGI module is a core part of Merecat httpd and is for security
## reasons disabled by default.  Like other modules it uses pattern
## matching to trigger the CGI functionality:
##	?	match a single char
##	*	matches any string excluding "/"
##	**	matches any string including "/"
##	separate multiple patterns with "|"
## Example: "**.sh|**.cgi"
##
## `limit` sets the max number of simultaneous CGI programs allowed.
##
## The below values are the default, so to enable CGI only `enabled`
## need to be set to 'true'.
#cgi "**.cgi|/cgi-bin/*" {
#    enabled = false
#    limit   = 50
#}

## The PHP module is bolted on top of the CGI module, so the same limits
## apply also to PHP scripts.  The below are the built-in defaults.
## Verify the path to the php-cgi binary for your system and expand on
## the pattern if you have, e.g. .php5 files.
#php "**.php*" {
#    enabled  = false
#    cgi-path = "/usr/bin/php-cgi"
#}

## The SSI module, like PHP above, is built on top of the CGI module,
## and it also requires the Merecat SSI CGI script to be installed, the
## defaults are commented out below.  The silent setting controls the
## default <!--#config errmsg="..." --> value.
#ssi "**.shtml" {
#    enabled  = false
#    silent   = false
#    cgi-path = "cgi-bin/ssi"
#}

## Server specific settings, overrides certain global settings
## Notice the HTTP redirect from the default server to HTTPS.
server default {
     port = 80
}

#server secure {
#    port = 443
#    ssl {
#	certfile = letsencrypt/cert.pem
#	keyfile = letsencrypt/privkey.pem
#	dhfile = certs/dhparam.pem
#    }
#}

FTBFS without libConfuse or --without-config (master)

Using master v2.32,
autogen.sh
build.sh
the following problem occurs
CC merecat-base64.o
CC merecat-md5.o
CC merecat-merecat.o
CC merecat-mmc.o
CC merecat-pidfile.o
In file included from merecat.c:52:0:
conf.h: In function ‘conf_srv’:
conf.h:88:16: error: ‘do_ssl’ undeclared (first use in this function)
arr[0].ssl = do_ssl;
^
conf.h:88:16: note: each undeclared identifier is reported only once for each function it appears in
Makefile:563: recipe for target 'merecat-merecat.o' failed
make[2]: *** [merecat-merecat.o] Error 1

Re-add thttpd-style logging?

Hi!

I've been using thttpd and switched to merecat for its TLS support. It's been excellent so far, however, it has a completely different logging style, and I can't seem to be able to get thttpd-style logging back, though I would like it because it seems to be more complete, and I have already written a parser around it.

Unfortunately, my knowledge of C is rather limited, and I don't know either codebase well enough.

Therefore, I, and perhaps the author of #25 as well, would love it if it could be added to merecat as well, or possibly some directions as to where one would find the old and new logging code.

Thanks, any help is much appreciated!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.