Debian 8 Installing an Apache Server

Domain name: example.com     Realm name: EXAMPLE.COM

Workgroup: EXAMPLE     Server IP address: xx.xx.xx.xx

Server name: linuxsvr01     Client name: linuxclnt01

Root password: ?Pa55w0rd!

The following command installs Apache2 Web Server

# aptitude -y install apache2

Next the configuration, in the first config file you need to uncomment line 28 and change it from full to Prod

# vi /etc/apache2/conf-enabled/security.conf
19 # ServerTokens
20 # This directive configures what you return as the Server HTTP response
21 # Header. The default is 'Full' which sends information about the OS-Type
22 # and compiled in modules.
23 # Set to one of:  Full | OS | Minimal | Minor | Major | Prod
24 # where Full conveys the most information, and Prod the least.
25 #ServerTokens Minimal
26 ServerTokens OS
27 ServerTokens Prod

Second config file, make any changes on line 2

# vi /etc/apache2/mods-enabled/dir.conf
1 <IfModule mod_dir.c>
2         DirectoryIndex index.html index.cgi index.php
3 </IfModule>
5 # vim: syntax=apache ts=4 sw=4 sts=4 sr noet

Third config file, add uncommented the server name or ip address on line 70

# vi /etc/apache2/apache2.conf
67 # Do NOT add a slash at the end of the directory path.
68 #
69 #ServerRoot "/etc/apache2"
70 ServerName linuxsvr02
71 #

Now we must restart the web server

# systemctl restart apache2

Input http://linuxsvr03 into a web browser to check the config, if good the "Apache2 Debian Default Page" will be shown.

Now to install PHP

# aptitude -y install php5 php5-cgi libapache2-mod-php5 php5-common php-pear

Set timezone

# vi /etc/php5/apache2/php.ini
891 [Date]
892 ; Defines the default timezone used by the date functions
893 ; http://php.net/date.timezone
894 date.timezone = "Europe/London"

Restart the web server

# systemctl restart apache2

Test the PHP configuration by creating the following new file and enter the text highlighted

# vi /var/www/html/info.php
<?php phpinpfo(); ?>

In a web browser type http://linuxsvr02/info.php and a complete PHP Info page will be shown.