Ubuntu Apache Webserver: Difference between revisions

From Hackers & Designers
No edit summary
Line 26: Line 26:


== Refresh! ==
== Refresh! ==
== Step 5 : Copying files ==
=== scp ===
I recommend using the <code>scp</code> 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 <code>ftp</code>, but encrypted and secure.
Example 1: Copy a new single index.html to the webserver.
<code>you@laptop:~$ scp index.html root@213.108.110.46:/var/www/html</code>
Example 2: Copy an entire directory, files, and sub-directories to the webserver.
<code>you@laptop:~$ scp -r * root@213.108.110.46:/var/www/html</code>

Revision as of 13:43, 10 May 2016

Installing Apache Webserver on Ubuntu

Step 1 : SSH to your instance

you@laptop:~$ ssh root@213.108.110.46

Step 2 : Install Apache Webserver

root@jbg:~# apt-get install apache2

Step 3 : 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 4 : 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 5 : 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