Ubuntu Apache Webserver: Difference between revisions

From Hackers & Designers
No edit summary
Line 5: Line 5:
<code>you@laptop:~$ ssh root@213.108.110.46</code>
<code>you@laptop:~$ ssh root@213.108.110.46</code>


== Step 2 : Install Apache Webserver ==
== Step 2 : Update package manager ==
 
<code>root@jbg:~# apt-get update</code>
 
== Step 3 : Install Apache Webserver ==


<code>root@jbg:~# apt-get install apache2</code>
<code>root@jbg:~# apt-get install apache2</code>


== Step 3 : Check the Webserver ==
== Step 4 : Check the Webserver ==


Put your instance IP address (ex. 213.108.110.46) into your browser.  You should see a page called "Apache2 Ubuntu Default Page".
Put your instance IP address (ex. 213.108.110.46) into your browser.  You should see a page called "Apache2 Ubuntu Default Page".


== Step 4 : Create your own homepage ==
== Step 5 : Create your own homepage ==


<code>root@jbg:~# cd /var/www/html</code>
<code>root@jbg:~# cd /var/www/html</code>
Line 27: Line 31:
== Refresh! ==
== Refresh! ==


== Step 5 : Copying files ==
== Step 6 : Copying files ==


=== scp ===
=== scp ===

Revision as of 13:02, 1 July 2016

Installing Apache Webserver on Ubuntu

Step 1 : SSH to your instance

you@laptop:~$ ssh root@213.108.110.46

Step 2 : Update package manager

root@jbg:~# apt-get update

Step 3 : Install Apache Webserver

root@jbg:~# apt-get install apache2

Step 4 : Check the Webserver

Put your instance IP address (ex. 213.108.110.46) into your browser. You should see a page called "Apache2 Ubuntu Default Page".

Step 5 : Create your own homepage

root@jbg:~# cd /var/www/html


Create a backup of the default page.

root@jbg:~# mv index.html index.html.bkup


root@jbg:~# echo '<h1>Welcome 127.0.0.1!</h1>' > index.html

Refresh!

Step 6 : Copying files

scp

I recommend using the scp command for copying files, or perhaps your file transfer application (CyberDuck, etc.) of preference also supports scp. File can be moved from your computer to the VPS via the terminal as well. It's a bit like ftp, but encrypted and secure.

Example 1: Copy a new single index.html to the webserver.

you@laptop:~$ scp index.html root@213.108.110.46:/var/www/html

Example 2: Copy an entire directory, files, and sub-directories to the webserver.

you@laptop:~$ scp -r * root@213.108.110.46:/var/www/html