This is what I use for a default host on my webservers. At present, only Nginx is represented.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Dan Langille 7ac983c246 Update '' 1 month ago
default_vhost_nginx Update 'default_vhost_nginx/configuration/virtualhost-common.conf' 1 month ago Update '' 1 month ago

I like to have a default host for my web server even when it contains only one website.


Bots, mostly. They poke around, look for stuff, often by IP address. A default host helps to keep that crap out of the logs of the main website.

Right now, it's only for Nginx. One day, I'll add Apache.

It implements two status calls:


That output looks like this:

$ fetch -o -  http://localhost/status
-                                                        0  B    0  Bpspool:                 www
process manager:      dynamic
start time:           26/Feb/2020:22:01:02 +0000
start since:          176901
accepted conn:        854
listen queue:         0
max listen queue:     0
listen queue len:     0
idle processes:       19
active processes:     1
total processes:      20
max active processes: 5
max children reached: 0
slow requests:        0
-                                                      378  B 1377 kBps    00s


That output looks like this:

 $ fetch -o -  http://localhost/nginx-status
-                                               0% of  104  B    0  BpsActive connections: 1 
server accepts handled requests
 631 631 1418 
Reading: 0 Writing: 1 Waiting: 0 
-                                                      104  B  436 kBps    00s

I use these in conjunction with LibreNMS and snmpd to produce pretty graphs.

This is the nginx.conf I use with this project:

user  www;
worker_processes  8;
error_log /var/log/nginx/error.log info;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    access_log /var/log/nginx/access.log;

    sendfile           on;
    keepalive_timeout  65;

    include /usr/local/etc/nginx/includes/*.conf;



Naturally, for me, this is FreeBSD specific, but easily adjusted to any other OS.

Install to /usr/local/www/default_vhost_nginx

mkdir /usr/local/etc/nginx/includes
cd /usr/local/etc/nginx/includes
ln -s /usr/local/www/default_vhost_nginx/configuration/vhosts.conf default_vhost_nginx.conf
service nginx configtest
service nginx restart

Try the fetch commands above.