Hosting static website on various cloud storage like DropBx, OpenStack Swift including Rackspace Cloud Files etc is our old topic with various examples. Silex is a F/OSS Static Website Editor Intended to be Accessed via Browser to Host Sites on Cloud Storages, However it Has Packages for GNU/Linux localhost too. Here is How to Install Silex Static Website Builder on Ubuntu Server. Silex project itself a non-profit and sponsored. Question may arise why one with a server will need a cloud storage to host website? The reason is multiple – we often need just few pages website for certain purposes and may be monitoring security does not worth. Normal unmanaged servers face continuous hacking attempts.
We have VPSDime 6GB server and Aruba Cloud 1 GB server as cheap options of servers to deploy this. Of course you can use Red Hat OpenShift or Heroku PaaS or IBM Cloud (Bluemix) for the job. But, PaaS free tiers no longer has so much freedom unlike 7 years ago. Although Silex will not consume huge resources, using VPSDime 6 GB is practical if need is multiple sites or for a small community.
How to Install Silex : Static Website Builder on Ubuntu Server
Here is the repo of Silex :
---
1 | https://github.com/silexlabs/Silex |
Also, you can try their live version running :
1 | https://editor.silex.me/ |
If you are using Docker, then :
1 2 3 4 | git clone https://github.com/silexlabs/Silex.git cd Silex docker build -t silex-image . docker run -p 6805:6805 -t silex-image |
Open http://your-server-ip:6805/
.
If you are not using Docker, simply running the server OS like CentOS, Ubuntu then you need to install node.js,
NPM, python, java. That is easy, like for Ubuntu server :
1 2 3 4 5 6 7 8 | sudo apt-get update sudo apt-get install python-software-properties python g++ make sudo add-apt-repository ppa:chris-lea/node.js sudo apt-get update sudo apt-get install default-jdk sudo apt-get install nodejs sudo apt-get install npm nodejs -v |
Run :
1 | sudo update-alternatives --config java |
Copy the path from your preferred installation and then open :
1 | nano /etc/environment |
At the end of this file, add the following line, making sure to replace the path with your own copied path :
1 2 | # replace /usr/lib/jvm/java-path JAVA_HOME="/usr/lib/jvm/java-path" |
Reload and check :
1 2 | source /etc/environment echo $JAVA_HOME |
Suppose you want to host it at /var/www/html
directory, then CD to it and :
1 2 3 | git clone --depth 10 https://github.com/silexlabs/Silex.git npm install npm run build |
You need the following dependencies (please check the dependencies at https://github.com/silexlabs/Silex
) :
1 2 3 | https://github.com/silexlabs/CloudExplorer2 https://github.com/ajaxorg/ace https://github.com/google/closure-compiler |
Then build it :
1 2 | npm install npm run build |
Python normally installed on modern version of servers. However, you may need a frontend webserver, like Nginx :
1 | sudo apt-get install nginx |
Navigate to :
1 2 | cd /etc/nginx/sites-available/ ls -al |
Edit the default file to make it looking like :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | upstream myapp { server 127.0.0.1:6805; keepalive 8; } # the nginx server instance server { listen 0.0.0.0:80; server_name example.com www.example.com; access_log /var/log/nginx/example.com.log; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://myapp/; proxy_redirect off; } } |