Print this Page

Home Server Internal Apache Management Web

Index.

20-Jun-2011: initial release.
18-Jan-2012: some small updates.

 

Introduction.

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.

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.

 

Installation.

Install php-apache, this will automatic install the apache web server plus php.

[root@homsrv ~]# pacman -S php-apache
resolving dependencies...
looking for inter-conflicts...

Targets (6): php-5.3.6-4  apr-1.4.5-1  unixodbc-2.3.0-1  apr-util-1.3.12-1
 apache-2.2.19-1  php-apache-5.3.6-4

Total Download Size:    5.80 MB
Total Installed Size:   28.20 MB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 php-5.3.6-4-i686          2.8M 1093.0K/s 00:00:03 [######################] 100%
 apr-1.4.5-1-i686        253.6K  652.3K/s 00:00:00 [######################] 100%
 unixodbc-2.3.0-1-i686   190.6K  583.4K/s 00:00:00 [######################] 100%
 apr-util-1.3.12-1-i686  164.1K  551.7K/s 00:00:00 [######################] 100%
 apache-2.2.19-1-i686    880.0K  969.6K/s 00:00:01 [######################] 100%
 php-apache-5.3.6-4...  1577.7K 1047.3K/s 00:00:02 [######################] 100%
(6/6) checking package integrity                   [######################] 100%
(6/6) checking for file conflicts                  [######################] 100%
(1/6) installing php                               [######################] 100%
(2/6) installing apr                               [######################] 100%
(3/6) installing unixodbc                          [######################] 100%
(4/6) installing apr-util                          [######################] 100%
(5/6) installing apache                            [######################] 100%
Optional dependencies for apache
 lynx: apachectl status
(6/6) installing php-apache                        [######################] 100%
[root@homsrv ~]#

Then, the changes in /etc/httpd/conf/httpd.conf, a lot of modules are disabled, which saves a lot of memory:

--- httpd.conf.orig     2011-06-25 15:59:01.519897725 +0200
+++ httpd.conf  2011-06-25 15:59:01.466564389 +0200
@@ -52,72 +52,73 @@
 # LoadModule foo_module modules/mod_foo.so
 #
 LoadModule authn_file_module modules/mod_authn_file.so
-LoadModule authn_dbm_module modules/mod_authn_dbm.so
-LoadModule authn_anon_module modules/mod_authn_anon.so
-LoadModule authn_dbd_module modules/mod_authn_dbd.so
-LoadModule authn_default_module modules/mod_authn_default.so
+#LoadModule authn_dbm_module modules/mod_authn_dbm.so
+#LoadModule authn_anon_module modules/mod_authn_anon.so
+#LoadModule authn_dbd_module modules/mod_authn_dbd.so
+#LoadModule authn_default_module modules/mod_authn_default.so
 LoadModule authz_host_module modules/mod_authz_host.so
-LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
+#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
 LoadModule authz_user_module modules/mod_authz_user.so
-LoadModule authz_dbm_module modules/mod_authz_dbm.so
-LoadModule authz_owner_module modules/mod_authz_owner.so
-LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
-LoadModule authz_default_module modules/mod_authz_default.so
+#LoadModule authz_dbm_module modules/mod_authz_dbm.so
+#LoadModule authz_owner_module modules/mod_authz_owner.so
+#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
+#LoadModule authz_default_module modules/mod_authz_default.so
 LoadModule auth_basic_module modules/mod_auth_basic.so
-LoadModule auth_digest_module modules/mod_auth_digest.so
-LoadModule file_cache_module modules/mod_file_cache.so
-LoadModule cache_module modules/mod_cache.so
-LoadModule disk_cache_module modules/mod_disk_cache.so
-LoadModule mem_cache_module modules/mod_mem_cache.so
-LoadModule dbd_module modules/mod_dbd.so
-LoadModule dumpio_module modules/mod_dumpio.so
-LoadModule reqtimeout_module modules/mod_reqtimeout.so
-LoadModule ext_filter_module modules/mod_ext_filter.so
+#LoadModule auth_digest_module modules/mod_auth_digest.so
+#LoadModule file_cache_module modules/mod_file_cache.so
+#LoadModule cache_module modules/mod_cache.so
+#LoadModule disk_cache_module modules/mod_disk_cache.so
+#LoadModule mem_cache_module modules/mod_mem_cache.so
+#LoadModule dbd_module modules/mod_dbd.so
+#LoadModule dumpio_module modules/mod_dumpio.so
+#LoadModule reqtimeout_module modules/mod_reqtimeout.so
+#LoadModule ext_filter_module modules/mod_ext_filter.so
 LoadModule include_module modules/mod_include.so
-LoadModule filter_module modules/mod_filter.so
-LoadModule substitute_module modules/mod_substitute.so
-LoadModule deflate_module modules/mod_deflate.so
-LoadModule ldap_module modules/mod_ldap.so
+#LoadModule filter_module modules/mod_filter.so
+#LoadModule substitute_module modules/mod_substitute.so
+#LoadModule deflate_module modules/mod_deflate.so
+#LoadModule ldap_module modules/mod_ldap.so
 LoadModule log_config_module modules/mod_log_config.so
-LoadModule log_forensic_module modules/mod_log_forensic.so
-LoadModule logio_module modules/mod_logio.so
-LoadModule env_module modules/mod_env.so
-LoadModule mime_magic_module modules/mod_mime_magic.so
-LoadModule cern_meta_module modules/mod_cern_meta.so
-LoadModule expires_module modules/mod_expires.so
-LoadModule headers_module modules/mod_headers.so
-LoadModule ident_module modules/mod_ident.so
-LoadModule usertrack_module modules/mod_usertrack.so
-LoadModule unique_id_module modules/mod_unique_id.so
+#LoadModule log_forensic_module modules/mod_log_forensic.so
+#LoadModule logio_module modules/mod_logio.so
+#LoadModule env_module modules/mod_env.so
+#LoadModule mime_magic_module modules/mod_mime_magic.so
+#LoadModule cern_meta_module modules/mod_cern_meta.so
+#LoadModule expires_module modules/mod_expires.so
+#LoadModule headers_module modules/mod_headers.so
+#LoadModule ident_module modules/mod_ident.so
+#LoadModule usertrack_module modules/mod_usertrack.so
+#LoadModule unique_id_module modules/mod_unique_id.so
 LoadModule setenvif_module modules/mod_setenvif.so
-LoadModule version_module modules/mod_version.so
-LoadModule proxy_module modules/mod_proxy.so
-LoadModule proxy_connect_module modules/mod_proxy_connect.so
-LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
-LoadModule proxy_http_module modules/mod_proxy_http.so
-LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
-LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
-LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
+#LoadModule version_module modules/mod_version.so
+#LoadModule proxy_module modules/mod_proxy.so
+#LoadModule proxy_connect_module modules/mod_proxy_connect.so
+#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
+#LoadModule proxy_http_module modules/mod_proxy_http.so
+#LoadModule proxy_scgi_module modules/mod_proxy_scgi.so
+#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
+#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
 LoadModule ssl_module modules/mod_ssl.so
 LoadModule mime_module modules/mod_mime.so
-LoadModule dav_module modules/mod_dav.so
-LoadModule status_module modules/mod_status.so
-LoadModule autoindex_module modules/mod_autoindex.so
-LoadModule asis_module modules/mod_asis.so
-LoadModule info_module modules/mod_info.so
+#LoadModule dav_module modules/mod_dav.so
+#LoadModule status_module modules/mod_status.so
+#LoadModule autoindex_module modules/mod_autoindex.so
+#LoadModule asis_module modules/mod_asis.so
+#LoadModule info_module modules/mod_info.so
 LoadModule suexec_module modules/mod_suexec.so
 LoadModule cgi_module modules/mod_cgi.so
-LoadModule cgid_module modules/mod_cgid.so
-LoadModule dav_fs_module modules/mod_dav_fs.so
-LoadModule vhost_alias_module modules/mod_vhost_alias.so
-LoadModule negotiation_module modules/mod_negotiation.so
+#LoadModule cgid_module modules/mod_cgid.so
+#LoadModule dav_fs_module modules/mod_dav_fs.so
+#LoadModule vhost_alias_module modules/mod_vhost_alias.so
+#LoadModule negotiation_module modules/mod_negotiation.so
 LoadModule dir_module modules/mod_dir.so
-LoadModule imagemap_module modules/mod_imagemap.so
-LoadModule actions_module modules/mod_actions.so
-LoadModule speling_module modules/mod_speling.so
-LoadModule userdir_module modules/mod_userdir.so
+#LoadModule imagemap_module modules/mod_imagemap.so
+#LoadModule actions_module modules/mod_actions.so
+#LoadModule speling_module modules/mod_speling.so
+#LoadModule userdir_module modules/mod_userdir.so
 LoadModule alias_module modules/mod_alias.so
 LoadModule rewrite_module modules/mod_rewrite.so
+LoadModule php5_module modules/libphp5.so

@@ -152,7 +153,7 @@
 # e-mailed.  This address appears on some server-generated pages, such
 # as error documents.  e.g. admin@your-domain.com
 #
-ServerAdmin you@example.com
+ServerAdmin admin@wpl.uk

 #
 # ServerName gives the name and port that the server uses to identify itself.
@@ -161,7 +162,7 @@
 #
 # If your host doesn't have a registered DNS name, enter its IP address here.
 #
-#ServerName www.example.com:80
+ServerName homsrv.wpl.ym:80

 #
 # DocumentRoot: The directory out of which you will serve your
@@ -208,14 +209,14 @@
     # http://httpd.apache.org/docs/2.2/mod/core.html#options
     # for more information.
     #
-    Options Indexes FollowSymLinks
+    Options Indexes FollowSymLinks MultiViews

     #
     # AllowOverride controls what directives may be placed in .htaccess files.
     # It can be "All", "None", or any combination of the keywords:
     #   Options FileInfo AuthConfig Limit
     #
-    AllowOverride None
+    AllowOverride All

     #
     # Controls who can get stuff from this server.
@@ -279,7 +280,7 @@
     # define per- access logfiles, transactions will be
     # logged therein and *not* in this file.
     #
-    CustomLog "/var/log/httpd/access_log" common
+    CustomLog "/var/log/httpd/access_log" combined

     #
     # If you prefer a logfile with access, agent, and referer information
@@ -437,22 +438,22 @@
 #Include conf/extra/httpd-mpm.conf

 # Multi-language error messages
-Include conf/extra/httpd-multilang-errordoc.conf
+#Include conf/extra/httpd-multilang-errordoc.conf

 # Fancy directory listings
-Include conf/extra/httpd-autoindex.conf
+#Include conf/extra/httpd-autoindex.conf

 # Language settings
-Include conf/extra/httpd-languages.conf
+#Include conf/extra/httpd-languages.conf

 # User home directories
-Include conf/extra/httpd-userdir.conf
+#Include conf/extra/httpd-userdir.conf

 # Real-time info on requests and configuration
 #Include conf/extra/httpd-info.conf

 # Virtual hosts
-#Include conf/extra/httpd-vhosts.conf
+Include conf/extra/httpd-vhosts.conf

 # Local access to the Apache HTTP Server Manual
 #Include conf/extra/httpd-manual.conf
@@ -462,6 +463,9 @@

 # Various default settings
 Include conf/extra/httpd-default.conf
+Include conf/extra/php5_module.conf
+
+Include conf/extra/httpd-phpmyadmin.conf

 # Secure (SSL/TLS) connections
 #Include conf/extra/httpd-ssl.conf

And the he configuration diff of /etc/httpd/conf/extra/httpd-vhosts.conf:

--- httpd-vhosts.conf.orig      2011-05-30 12:03:51.000000000 +0200
+++ httpd-vhosts.conf   2011-06-24 13:10:22.000000000 +0200
@@ -25,21 +25,8 @@
 # match a ServerName or ServerAlias in any <VirtualHost> block.
 #
 <VirtualHost *:80>
-    ServerAdmin webmaster@dummy-host.example.com
-    DocumentRoot "/etc/httpd/docs/dummy-host.example.com"
-    ServerName dummy-host.example.com
-    ServerAlias www.dummy-host.example.com
-    ErrorLog "/var/log/httpd/dummy-host.example.com-error_log"
-    CustomLog "/var/log/httpd/dummy-host.example.com-access_log" common
+    ServerAdmin admin@wpl.uk
+    DocumentRoot /srv/http/htdocs
+    ServerName homsrv.wpl.ym
 </VirtualHost>

-<VirtualHost *:80>
-    ServerAdmin webmaster@dummy-host2.example.com
-    DocumentRoot "/etc/httpd/docs/dummy-host2.example.com"
-    ServerName dummy-host2.example.com
-    ErrorLog "/var/log/httpd/dummy-host2.example.com-error_log"
-    CustomLog "/var/log/httpd/dummy-host2.example.com-access_log" common
-</VirtualHost>

Now, the diffs in /etc/php/php.ini:

--- php.ini.orig        2011-06-24 15:43:06.000000000 +0200
+++ php.ini     2011-06-24 15:51:23.000000000 +0200
@@ -376,7 +376,7 @@
 ; or per-virtualhost web server configuration file. This directive is
 ; *NOT* affected by whether Safe Mode is turned On or Off.
 ; http://php.net/open-basedir
-open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/
+open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/var/state/dhcp

 ; This directive allows you to disable certain functions for security reasons.
 ; It receives a comma-delimited list of function names. This directive is
@@ -635,7 +635,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

 ;;;;;;;;;;;;;;;;;
 ; Data Handling ;
@@ -725,7 +725,7 @@

 ; Maximum size of POST data that PHP will accept.
 ; http://php.net/post-max-size
-post_max_size = 8M
+post_max_size = 32M

 ; Magic quotes are a preprocessing feature of PHP where PHP will attempt to
 ; escape any character sequences in GET, POST, COOKIE and ENV data which might
@@ -876,7 +876,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
@@ -938,47 +938,47 @@
 ; If you only provide the name of the extension, PHP will look for it in its
 ; default extension directory.
 ;
-;extension=bcmath.so
-;extension=bz2.so
-;extension=calendar.so
+extension=bcmath.so
+extension=bz2.so
+extension=calendar.so
 ;extension=curl.so
-;extension=dba.so
+extension=dba.so
 ;extension=enchant.so
-;extension=exif.so
-;extension=ftp.so
-;extension=gd.so
+extension=exif.so
+extension=ftp.so
+extension=gd.so
 extension=gettext.so
 ;extension=gmp.so
-;extension=iconv.so
-;extension=imap.so
+extension=iconv.so
+extension=imap.so
 ;extension=intl.so
-;extension=json.so
+extension=json.so
 ;extension=ldap.so
-;extension=mcrypt.so
+extension=mcrypt.so
 ;extension=mssql.so
-;extension=mysqli.so
-;extension=mysql.so
+extension=mysqli.so
+extension=mysql.so
 ;extension=odbc.so
-;extension=openssl.so
-;extension=pdo_mysql.so
+extension=openssl.so
+extension=pdo_mysql.so
 ;extension=pdo_odbc.so
 ;extension=pdo_pgsql.so
 ;extension=pdo_sqlite.so
 ;extension=pgsql.so
-;extension=phar.so
-;extension=posix.so
+extension=phar.so
+extension=posix.so
 ;extension=pspell.so
 ;extension=shmop.so ;extension=snmp.so
-;extension=soap.so
-;extension=sockets.so
+extension=soap.so
+extension=sockets.so
 ;extension=sqlite3.so
-;extension=sqlite.so
-;extension=sysvmsg.so
-;extension=sysvsem.so
-;extension=sysvshm.so
+extension=sqlite.so
+extension=sysvmsg.so
+extension=sysvsem.so
+extension=sysvshm.so
 ;extension=tidy.so
-;extension=xmlrpc.so
+extension=xmlrpc.so
 ;extension=xsl.so
 ;extension=zip.so

@@ -989,7 +989,7 @@
 [Date]
 ; 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

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

[root@homsrv ~]# mkdir -p /srv/http/htdocs
[root@homsrv ~]# /etc/rc.d/httpd start
:: Starting Apache Web Server                                            [DONE]
[root@homsrv ~]#

That’s it. In the support archive (nr 13 or higher) is a sample home page with some links to existing and feature utilities.

Home Server maintenance web

Home Server maintenance web

 

Add mcrypt.

Some programs that use php need the mcrypt extension. We already enabled the use of mcrypt in php.ini. Use the following commands to add it:

[root@homsrv ~]# pacman -S php-mcrypt
resolving dependencies...
looking for inter-conflicts...

Targets (2): libmcrypt-2.5.8-2  php-mcrypt-5.3.6-4

Total Download Size:    0.09 MB
Total Installed Size:   0.31 MB

Proceed with installation? [Y/n]
:: Retrieving packages from extra...
 libmcrypt-2.5.8-2-i686   81.0K  204.6K/s 00:00:00 [######################] 100%
 php-mcrypt-5.3.6-4...    10.2K  186.0K/s 00:00:00 [######################] 100%
(2/2) checking package integrity                   [######################] 100%
(2/2) checking for file conflicts                  [######################] 100%
(1/2) installing libmcrypt                         [######################] 100%
(2/2) installing php-mcrypt                        [######################] 100%
[root@homsrv ~]# /etc/rc.d/httpd restart
:: Restarting Apache Web Server                                          [DONE]
[root@homsrv ~]#

 

 

Download.

The complete configuration can be found in the next archive.

Linux Home Server complete package
Linux Home Server complete package
homeserver-complete.tar.gz
2.6 MiB
7 Downloads
Details...

 

Permanent link to this article: http://www.mbse.eu/linux/homeserver/essential/intweb/