In this post, I am going to configure my Ubuntu machine as APACHE web server. It all needs a package installation and then few edits in the configuration file...
ubu@ubuntu-new:~$
ubu@ubuntu-new:~$ su -
Password:
root@ubuntu-new:~#
root@ubuntu-new:~# service --status-all | grep apache
root@ubuntu-new:~#
We can see no service related to apache, let us check whether HTTP port is Open or not...
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 14357 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 14360 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 11656 /run/systemd/journal/stdout
unix 8 [ ] DGRAM 11657 /run/systemd/journal/socket
unix 2 [ ACC ] STREAM LISTENING 11660 /run/systemd/fsck.progress
unix 2 [ ] DGRAM 11824 /run/systemd/journal/syslog
unix 2 [ ACC ] STREAM LISTENING 11865 /run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 11937 /run/lvm/lvmetad.socket
unix 14 [ ] DGRAM 11940 /run/systemd/journal/dev-log
root@ubuntu-new:~#
Later we can see how output looks like when Http port is open.. So lets go with apache package installation...
We need to update our apt (Advanced Packaging Tool) using apt-get update...
root@ubuntu-new:~# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
liblua5.1-0 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,553 kB of archives.
After this operation, 6,412 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libapr1 amd64 1.5.2-4 [85.9 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1 amd64 1.5.4-2 [77.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-2 [10.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1-ldap amd64 1.5.4-2 [8,704 B]
Get:5 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 liblua5.1-0 amd64 5.1.5-8.1build1 [105 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-bin amd64 2.4.18-2ubuntu4 [920 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-utils amd64 2.4.18-2ubuntu4 [81.1 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-data all 2.4.18-2ubuntu4 [161 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2 amd64 2.4.18-2ubuntu4 [86.3 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 ssl-cert all 1.0.38 [17.0 kB]
Fetched 1,553 kB in 0s (2,658 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libapr1:amd64.
(Reading database ... 62996 files and directories currently installed.)
Preparing to unpack .../0-libapr1_1.5.2-4_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-4) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../1-libaprutil1_1.5.4-2_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-2) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../2-libaprutil1-dbd-sqlite3_1.5.4-2_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-2) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../3-libaprutil1-ldap_1.5.4-2_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.5.4-2) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../4-liblua5.1-0_5.1.5-8.1build1_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build1) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../5-apache2-bin_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2-bin (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../6-apache2-utils_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2-utils (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../7-apache2-data_2.4.18-2ubuntu4_all.deb ...
Unpacking apache2-data (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2.
Preparing to unpack .../8-apache2_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2 (2.4.18-2ubuntu4) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../9-ssl-cert_1.0.38_all.deb ...
Unpacking ssl-cert (1.0.38) ...
Setting up libapr1:amd64 (1.5.2-4) ...
Processing triggers for ufw (0.35-2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up apache2-data (2.4.18-2ubuntu4) ...
Setting up ssl-cert (1.0.38) ...
Processing triggers for libc-bin (2.24-3ubuntu1) ...
Setting up libaprutil1:amd64 (1.5.4-2) ...
Processing triggers for systemd (231-9git1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build1) ...
Setting up libaprutil1-ldap:amd64 (1.5.4-2) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-2) ...
Setting up apache2-utils (2.4.18-2ubuntu4) ...
Setting up apache2-bin (2.4.18-2ubuntu4) ...
Setting up apache2 (2.4.18-2ubuntu4) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.24-3ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (231-9git1) ...
Processing triggers for ufw (0.35-2) ...
root@ubuntu-new:~#
Once package is installed, port is open and in LISTEN state...
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
OUTPUT TRUNCATED...
root@ubuntu-new:~#
root@ubuntu-new:~# service --status-all | grep apache
[ + ] apache-htcacheclean
[ + ] apache2
root@ubuntu-new:~#
Open browser and type the IP at URL...
Now let us try stopping apache service and check again...
root@ubuntu-new:~# /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.
root@ubuntu-new:~#
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
****** If you observe closely there is no Http port *******
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 14357 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 14360 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 11656 /run/systemd/journal/stdout
unix 8 [ ] DGRAM 11657 /run/systemd/journal/socket
unix 2 [ ACC ] STREAM LISTENING 11660 /run/systemd/fsck.progress
unix 2 [ ] DGRAM 11824 /run/systemd/journal/syslog
unix 2 [ ACC ] STREAM LISTENING 11865 /run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 11937 /run/lvm/lvmetad.socket
unix 14 [ ] DGRAM 11940 /run/systemd/journal/dev-log
root@ubuntu-new:~#
Let us try from the browser this time...
Let us start the service again and continue with the configuration thing....
root@ubuntu-new:~# /etc/init.d/apache2 start
[ ok ] Starting apache2 (via systemctl): apache2.service.
root@ubuntu-new:~#
root@ubuntu-new:~#
root@ubuntu-new:~# cd /var/www/
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www# ls
html
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www# cd html/
root@ubuntu-new:/var/www/html# ls
index.html
root@ubuntu-new:/var/www/html#
In this location, we have the index file where we can edit few things and check the changes in title page working...
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# cat index.html | grep -i works
<title>Apache2 Ubuntu Default Page: It works</title>
It works!
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# vi index.html
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# cat index.html | grep -i working
My Ubuntu Server ready installed with APACHE: Page Loaded, Its Working..
this site is working properly. You should <b>replace this file</b> (located at
root@ubuntu-new:/var/www/html#
I edited few lines from the main index file, now when I open it in browser...
We can try designing a home page or any other pages using html, even try installing php...
#####################################################################################
ubu@ubuntu-new:~$
ubu@ubuntu-new:~$ su -
Password:
root@ubuntu-new:~#
root@ubuntu-new:~# service --status-all | grep apache
root@ubuntu-new:~#
We can see no service related to apache, let us check whether HTTP port is Open or not...
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 14357 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 14360 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 11656 /run/systemd/journal/stdout
unix 8 [ ] DGRAM 11657 /run/systemd/journal/socket
unix 2 [ ACC ] STREAM LISTENING 11660 /run/systemd/fsck.progress
unix 2 [ ] DGRAM 11824 /run/systemd/journal/syslog
unix 2 [ ACC ] STREAM LISTENING 11865 /run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 11937 /run/lvm/lvmetad.socket
unix 14 [ ] DGRAM 11940 /run/systemd/journal/dev-log
root@ubuntu-new:~#
Later we can see how output looks like when Http port is open.. So lets go with apache package installation...
We need to update our apt (Advanced Packaging Tool) using apt-get update...
root@ubuntu-new:~# apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
ssl-cert
Suggested packages:
www-browser apache2-doc apache2-suexec-pristine | apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
apache2 apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
liblua5.1-0 ssl-cert
0 upgraded, 10 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,553 kB of archives.
After this operation, 6,412 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libapr1 amd64 1.5.2-4 [85.9 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1 amd64 1.5.4-2 [77.1 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1-dbd-sqlite3 amd64 1.5.4-2 [10.6 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 libaprutil1-ldap amd64 1.5.4-2 [8,704 B]
Get:5 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 liblua5.1-0 amd64 5.1.5-8.1build1 [105 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-bin amd64 2.4.18-2ubuntu4 [920 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-utils amd64 2.4.18-2ubuntu4 [81.1 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2-data all 2.4.18-2ubuntu4 [161 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 apache2 amd64 2.4.18-2ubuntu4 [86.3 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu yakkety/main amd64 ssl-cert all 1.0.38 [17.0 kB]
Fetched 1,553 kB in 0s (2,658 kB/s)
Preconfiguring packages ...
Selecting previously unselected package libapr1:amd64.
(Reading database ... 62996 files and directories currently installed.)
Preparing to unpack .../0-libapr1_1.5.2-4_amd64.deb ...
Unpacking libapr1:amd64 (1.5.2-4) ...
Selecting previously unselected package libaprutil1:amd64.
Preparing to unpack .../1-libaprutil1_1.5.4-2_amd64.deb ...
Unpacking libaprutil1:amd64 (1.5.4-2) ...
Selecting previously unselected package libaprutil1-dbd-sqlite3:amd64.
Preparing to unpack .../2-libaprutil1-dbd-sqlite3_1.5.4-2_amd64.deb ...
Unpacking libaprutil1-dbd-sqlite3:amd64 (1.5.4-2) ...
Selecting previously unselected package libaprutil1-ldap:amd64.
Preparing to unpack .../3-libaprutil1-ldap_1.5.4-2_amd64.deb ...
Unpacking libaprutil1-ldap:amd64 (1.5.4-2) ...
Selecting previously unselected package liblua5.1-0:amd64.
Preparing to unpack .../4-liblua5.1-0_5.1.5-8.1build1_amd64.deb ...
Unpacking liblua5.1-0:amd64 (5.1.5-8.1build1) ...
Selecting previously unselected package apache2-bin.
Preparing to unpack .../5-apache2-bin_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2-bin (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2-utils.
Preparing to unpack .../6-apache2-utils_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2-utils (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2-data.
Preparing to unpack .../7-apache2-data_2.4.18-2ubuntu4_all.deb ...
Unpacking apache2-data (2.4.18-2ubuntu4) ...
Selecting previously unselected package apache2.
Preparing to unpack .../8-apache2_2.4.18-2ubuntu4_amd64.deb ...
Unpacking apache2 (2.4.18-2ubuntu4) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../9-ssl-cert_1.0.38_all.deb ...
Unpacking ssl-cert (1.0.38) ...
Setting up libapr1:amd64 (1.5.2-4) ...
Processing triggers for ufw (0.35-2) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up apache2-data (2.4.18-2ubuntu4) ...
Setting up ssl-cert (1.0.38) ...
Processing triggers for libc-bin (2.24-3ubuntu1) ...
Setting up libaprutil1:amd64 (1.5.4-2) ...
Processing triggers for systemd (231-9git1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up liblua5.1-0:amd64 (5.1.5-8.1build1) ...
Setting up libaprutil1-ldap:amd64 (1.5.4-2) ...
Setting up libaprutil1-dbd-sqlite3:amd64 (1.5.4-2) ...
Setting up apache2-utils (2.4.18-2ubuntu4) ...
Setting up apache2-bin (2.4.18-2ubuntu4) ...
Setting up apache2 (2.4.18-2ubuntu4) ...
Enabling module mpm_event.
Enabling module authz_core.
Enabling module authz_host.
Enabling module authn_core.
Enabling module auth_basic.
Enabling module access_compat.
Enabling module authn_file.
Enabling module authz_user.
Enabling module alias.
Enabling module dir.
Enabling module autoindex.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module filter.
Enabling module deflate.
Enabling module status.
Enabling conf charset.
Enabling conf localized-error-pages.
Enabling conf other-vhosts-access-log.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.24-3ubuntu1) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (231-9git1) ...
Processing triggers for ufw (0.35-2) ...
root@ubuntu-new:~#
Once package is installed, port is open and in LISTEN state...
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:http [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
OUTPUT TRUNCATED...
root@ubuntu-new:~#
root@ubuntu-new:~# service --status-all | grep apache
[ + ] apache-htcacheclean
[ + ] apache2
root@ubuntu-new:~#
Open browser and type the IP at URL...
Now let us try stopping apache service and check again...
root@ubuntu-new:~# /etc/init.d/apache2 stop
[ ok ] Stopping apache2 (via systemctl): apache2.service.
root@ubuntu-new:~#
root@ubuntu-new:~# netstat -a | more
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:hostmon 0.0.0.0:* LISTEN
tcp 0 0 localhost:domain 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 64 ubuntu-new:ssh 10.0.0.43:52040 ESTABLISHED
****** If you observe closely there is no Http port *******
tcp6 0 0 [::]:hostmon [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
udp 0 0 localhost:domain 0.0.0.0:*
udp 0 0 0.0.0.0:bootpc 0.0.0.0:*
udp 0 0 0.0.0.0:hostmon 0.0.0.0:*
udp6 0 0 [::]:hostmon [::]:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ] DGRAM 18460 /run/user/1000/systemd/notify
unix 2 [ ACC ] SEQPACKET LISTENING 11655 /run/udev/control
unix 2 [ ACC ] STREAM LISTENING 18461 /run/user/1000/systemd/private
unix 3 [ ] DGRAM 11648 /run/systemd/notify
unix 2 [ ACC ] STREAM LISTENING 14344 /run/snapd.socket
unix 2 [ ] DGRAM 11649 /run/systemd/cgroups-agent
unix 2 [ ACC ] STREAM LISTENING 14345 /run/snapd-snap.socket
unix 2 [ ACC ] STREAM LISTENING 11650 /run/systemd/private
unix 2 [ ACC ] STREAM LISTENING 14357 /run/uuidd/request
unix 2 [ ACC ] STREAM LISTENING 14360 /run/acpid.socket
unix 2 [ ACC ] STREAM LISTENING 11656 /run/systemd/journal/stdout
unix 8 [ ] DGRAM 11657 /run/systemd/journal/socket
unix 2 [ ACC ] STREAM LISTENING 11660 /run/systemd/fsck.progress
unix 2 [ ] DGRAM 11824 /run/systemd/journal/syslog
unix 2 [ ACC ] STREAM LISTENING 11865 /run/lvm/lvmpolld.socket
unix 2 [ ACC ] STREAM LISTENING 11937 /run/lvm/lvmetad.socket
unix 14 [ ] DGRAM 11940 /run/systemd/journal/dev-log
root@ubuntu-new:~#
Let us try from the browser this time...
Let us start the service again and continue with the configuration thing....
root@ubuntu-new:~# /etc/init.d/apache2 start
[ ok ] Starting apache2 (via systemctl): apache2.service.
root@ubuntu-new:~#
root@ubuntu-new:~#
root@ubuntu-new:~# cd /var/www/
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www# ls
html
root@ubuntu-new:/var/www#
root@ubuntu-new:/var/www# cd html/
root@ubuntu-new:/var/www/html# ls
index.html
root@ubuntu-new:/var/www/html#
In this location, we have the index file where we can edit few things and check the changes in title page working...
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# cat index.html | grep -i works
<title>Apache2 Ubuntu Default Page: It works</title>
It works!
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# vi index.html
root@ubuntu-new:/var/www/html#
root@ubuntu-new:/var/www/html# cat index.html | grep -i working
My Ubuntu Server ready installed with APACHE: Page Loaded, Its Working..
this site is working properly. You should <b>replace this file</b> (located at
root@ubuntu-new:/var/www/html#
I edited few lines from the main index file, now when I open it in browser...
We can try designing a home page or any other pages using html, even try installing php...
#####################################################################################