Home Server Internal Nginx Management Web


18-Jan-2012: Initial release.
25-Nov-2012: adjusted for Slackware.
04-Jan-2013: improved some nginx.conf settings.
31-Oct-2013: small fix to nginx.conf



For maintenance of our Home Server we need an internal web server. On this server we can install things for example like phpMyAdmin to have easy access to our MySQL server. We could also create a Intra-net server, but in a Home environment that is not so useful.

Slackware’s standard web server is Apache, but I have seen that nginx (engine-X) performs better and uses less memory. The performance issue is not so important for a maintenance web server, but nginx is more flexible to configure compared with Apache. Each virtual server can have it’s own special setup, and using several virtual servers for a maintenance server is a good plan. For this article I start with just one virtual server.

To use php with nginx you need to have php-fpm. This is the Fast Process Manager that takes a php request from nginx and hands it over to php, and then returns the processed results back to nginx. Since Slackware 14.0 the php package is build with php-fpm support so you can use the shipped package. If you use an older Slackware, you must build php yourself to include php-fpm support.

[important]This server is not intended to be your external web server, but it is possible to do that. The setup below is NOT suited for external use! You need to make several changes to let it function as an and external server. My advice is use a separate virtual server.[/important]



Install all the software that we need to run nginx on our Home Server: From the standard Slackware distribution we need the following packages:

Series l:
aspell-0.60.6-i486-1            aspell-en-6.0_0-noarch-4
enchant-1.5.0-i486-1            icu4c-49.1.2-i486-1
libmcrypt-2.5.8-i486-1          libxml2-2.8.0-i486-1
libxslt-1.1.26-i486-2           t1lib-5.1.2-i486-3

Series n:

Series x:
libX11-1.5.0-i486-1             libXau-1.0.7-i486-1
libXdmcp-1.1.1-i486-1           libXpm-3.5.10-i486-1


Using the buildscripts build the following packages:

nginx-1.2.5                     fcgi-2.4.0
fcgiwrap-1.0.3                  spawn-fcgi-1.6.3


The PHP package needs some configuration, here is the diff output of /etc/httpd/php.ini:

--- php.ini-production  2012-09-14 21:41:46.000000000 +0200
+++ php.ini     2012-11-22 14:08:37.797256284 +0100
@@ -583,7 +583,7 @@
 ; Example:
 ;error_log = php_errors.log
 ; Log errors to syslog (Event Log on NT, not valid in Windows 95).
-;error_log = syslog
+error_log = syslog

 ; Default value: 0
@@ -669,7 +669,7 @@
 ; Its value may be 0 to disable the limit. It is ignored if POST data reading
 ; is disabled through enable_post_data_reading.
 ; http://php.net/post-max-size
-post_max_size = 8M
+post_max_size = 32M

 ; Automatically add files before PHP document.
 ; http://php.net/auto-prepend-file
@@ -797,7 +797,7 @@

 ; Maximum allowed size for uploaded files.
 ; http://php.net/upload-max-filesize
-upload_max_filesize = 2M
+upload_max_filesize = 32M

 ; Maximum number of files that can be uploaded via a single request
 max_file_uploads = 20
@@ -956,7 +956,7 @@
 ; Defines the default timezone used by the date functions
 ; http://php.net/date.timezone
-;date.timezone =
+date.timezone = Europe/Amsterdam

 ; http://php.net/date.default-latitude
 ;date.default_latitude = 31.7667


Then the changes in /etc/php-fpm.conf:

--- php-fpm.conf.default        2012-09-14 21:44:11.000000000 +0200
+++ php-fpm.conf        2012-11-21 14:32:23.198834635 +0100
@@ -148,7 +148,8 @@
 ;                            specific port;
 ;   '/path/to/unix/socket' - to listen on a unix socket.
 ; Note: This value is mandatory.
-listen =
+;listen =
+listen = /var/run/php-fpm.sock

 ; Set listen(2) backlog.
 ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
@@ -159,9 +160,9 @@
 ; BSD-derived systems allow connections regardless of permissions. 
 ; Default Values: user and group are set as the running user
 ;                 mode is set to 0666
-;listen.owner = apache
-;listen.group = apache
-;listen.mode = 0666
+listen.owner = apache
+listen.group = apache
+listen.mode = 0660

 ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
 ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original


The configuration file /etc/nginx/nginx.xonf:

# /etc/nginx/nginx.conf at homsrv.wpl.ym

worker_processes        1;
error_log               /var/log/nginx/error.log;

events {
    worker_connections  64;
    accept_mutex_delay  50ms;

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

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    sendfile            on;
    keepalive_timeout   300 300;
    gzip                on;
    gzip_comp_level     1;
    gzip_min_length     100;
    gzip_vary           on;
    gzip_proxied        expired no-cache no-store private auth;
    gzip_types          text/plain text/css application/x-javascript 
                        text/xml application/xml application/xml+rss 
    gzip_disable        "MSIE [1-6]\.";

    # Upstream to abstract backend connection(s) for PHP.
    upstream php {
        server          unix:/var/run/php-fpm.sock;
    upstream cgi {
    server {
        listen          [2001:1af8:fecf:7ea0::fd]:80;
        listen          [2001:1af8:fecf:7ea1::2]:80;
        server_name     homsrv.wpl.ym;
        root            /srv/http/htdocs;
        access_log      /var/log/nginx/access.log main;
        error_log       /var/log/nginx/error.log;
        index           index.html index.php;

        location ~ \.php$ {
            include             fastcgi.conf;
            fastcgi_pass        php;
    include sites.d/*;


Now, for the first time start the server like this:

root@homsrv:~# chmod 755 /etc/rc.d/rc.php-fpm
root@homsrv:~# /etc/rc.d/rc.php-fpm start
Starting php-fpm  done
root@homsrv:~# /etc/rc.d/init.d/fcgiwrap start
Starting fcgiwrap for user: apache dspam 
root@homsrv:~# chmod 755 /etc/rc.d/rc.httpd 
root@homsrv:~# mkdir -p /srv/http/htdocs/
root@homsrv:~# /etc/rc.d/rc.httpd start
Starting Nginx server daemon...


Use pkgtool to activate fcgiwrap to start at boot.

That’s it. In the support archive is a sample home page with some links to existing and feature utilities.

Home Server maintenance web

Home Server maintenance web




See the download page for the script and configuration files.