Cloud Foundry – Hosting a Static Web App


Step-by-Step Guide to publish your Static Web App

 

1. Create a sample Web/HTML page. Start by creating the application root directory.

/home/<my-user>/hello-pws

$ mkdir /home/engineer/hello-pws

2. Enter the application root directory and create a sample HTML file for publishing. Use the following content of the HTML. Use your preferred text editor. Save the file as index.html

$ nano /home/engineer/hello-pws/index.html

Add the following content:

3. You should have the following similar structure.
/home/engineer/hello-pws/
/home/engineer/hello-pws/index.html

4. Signup at http://run.pivotal.io/ for Pivotal Web Services

5. Install the command line tools, for the specific version for your OS, visit https://console.run.pivotal.io/tools.

Ubuntu 64-bit :

$ wget https://s3-us-west-1.amazonaws.com/cf-cli-releases/releases/v6.34.1/cf-cli-installer_6.34.1_x86-64.deb
$ sudo dpkg -i cf-cli-installer_6.34.1_x86-64.deb

6. Once installed, run the following on your command line, to login.

$ cf login -a https://api.run.pivotal.io

Enter your email and password that you registered at http://run.pivotal.io/

7. Change to the application root directory

$ cd /home/engineer/hello-pws

8. Push your application to the PWS

$ cf push hello-pws-2 -b staticfile_buildpack

9. Wait until the deployment is finished. It will show something like:

10. Visit the following URL to open the application

https://hello-pws-2.cfapps.io

 

11. You can check the applications and routes you have deployed by visting https://console.run.pivotal.io. 

 

You have now successfully deployed a static web app. Congratulations!

Previous Setting up Let's Encrypt - SSL for Domains
Next Configure SSL in Nginx