SlideShare a Scribd company logo
How to turn any dynamic
(CMS powered) website
into a static site
Artem Daniliants • LumoSpark
Traditional website architecture
Web Server
DNS server
Database
Scripting interpreter
Example: Amazon Route 53/CloudFlare
Example: Nginx, Apache
Example: PHP, Python, Perl
Example: MariaDB, PostgreSQL
What happens
when you navigate to a URL?
Static site Dynamic site
WTF is a server? :)
Dedicated vs VPS vs Shared hosting?
vs
OpenVZ vs KVM
RAM
Hard drive
RAID
CPU
32bit vs 64bit
Traffic
Network connection
Server location
Operating system
Let’s get a cheap server (from Scaleway)
Terminal cast displaying whole process
https://asciinema.org/a/cugTNawObYXONGpqmdN8gn12t
First minutes on the server
Change your password
passwd root
Install fail2ban
apt-get update && apt-get install fail2ban
Allow only public key authentication
nano -w /etc/ssh/sshd_config
# INFO: Find following lines in config and change them as follows
PasswordAuthentication no
UsePAM no
PermitRootLogin no
Create new user & setup sudo
useradd -m username
chsh -s /bin/bash username
apt-get install sudo
visudo
# INFO: Add following line
username ALL=(ALL) ALL
# Add public key to newly created user
mkdir /home/username/.ssh
nano -w /home/username/.ssh/authorized_keys
chmod 600 /home/username/.ssh/authorized_keys
chown -R username /home/username/.ssh
Enable Automatic Security Updates
apt-get install unattended-upgrades
dpkg-reconfigure --priority=low unattended-upgrades
# Follow instructions on the screen
Install Logwatch
apt-get install logwatch
nano -w /etc/cron.daily/00logwatch
# INFO: Replace “/usr/sbin/logwatch --output mail” with line below
/usr/sbin/logwatch --output mail --mailto you@gmail.com --detail
high
Enough prep work :)
Using reverse proxy
Dynamic site
(cms.domain.com)
Reverse proxy
(www.domain.com)
Visitor
Install Nginx
apt-get install nginx
Setup domain
nano -w /etc/nginx/sites-enabled/default
# INFO: Find server_name and change it
server_name somedomain.com;
Install SSL (Let’s encrypt)
sudo apt-get install software-properties-common python-software-properties
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-nginx
# Below is one command in multiple lines (paste as one)
sudo certbot --authenticator standalone --installer nginx -d
somedomain.name.com --pre-hook "service nginx stop" --post-hook "service
nginx start"
Setup reverse proxy
nano -w /etc/nginx/sites-enabled/default
location / {
proxy_pass_header Authorization;
proxy_pass http://dynamic-site.com;
proxy_set_header Host dynamic-site.com;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_buffering on;
client_max_body_size 0;
proxy_read_timeout 36000s;
proxy_redirect off;
proxy_ssl_server_name on;
}
Testing
root@scw-e42236:~# curl -I https://testing.domain.com/test.php
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 24 Jan 2018 08:04:53 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Proxy-Cache: MISS
Setup caching (part 1)
nano -w /etc/nginx/nginx.conf
http {
[...]
proxy_cache_path /tmp levels=1:2 keys_zone=fatcache:8m
max_size=1000m inactive=600m;
proxy_cache_key "$scheme$host$request_uri";
[...]
}
Setup caching (part 2)
nano -w /etc/nginx/sites-enabled/default
proxy_ignore_headers "Set-Cookie";
proxy_hide_header "Set-Cookie";
proxy_cache fatcache;
add_header X-Proxy-Cache $upstream_cache_status;
proxy_cache_valid 200 302 60m;
proxy_cache_valid 404 1m;
With cache
root@scw-e42236:~# curl -I https://testing.domain.com/test.php
HTTP/1.1 200 OK
Server: nginx/1.10.3 (Ubuntu)
Date: Wed, 24 Jan 2018 08:04:55 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Proxy-Cache: HIT
You’re done
Things that could be improved
Programmatically purging Nginx cache
Setting up Pagespeed module
Using Docker
Deploying to Zeit.co / Hyper.sh
Restrict so dynamic site is not
accessible publicly
Further reading
https://mobisoftinfotech.com/resources/mguide/setting-nginx-reverse-proxy-ubuntu-16-04-server-aws-ec2/
https://training.linuxfoundation.org/free-linux-training/linux-training-videos
https://news.ycombinator.com/item?id=5316093
https://www.codelitt.com/blog/my-first-10-minutes-on-a-server-primer-for-securing-ubuntu/
https://www.reddit.com/r/netsec/comments/4o7wpo/my_first_10_minutes_on_a_server/
https://news.ycombinator.com/item?id=11909543
https://plusbryan.com/my-first-5-minutes-on-a-server-or-essential-security-for-linux-servers
https://github.com/Levantado/ngx_pagespeed-install-script
https://www.techandme.se/set-up-nginx-reverse-proxy/
https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server
Thank you
for attention!
LumoSpark
artem.daniliants@lumospark.com
Image credits
https://blog.resellerspanel.com/virtual-private-servers/kvm-openvz-vps-summer-promo.html

More Related Content

What's hot (20)

PDF
PBX on a non-specialized distro
StefanoFancello
 
PDF
StackiFest16: What's Next in Stacki - Mason Katz
StackIQ
 
PDF
A Better WordPress Workflow with WP-CLI
Rikesh Ramlochund
 
PDF
Caching for Cash: Benchmarking and Profiling
Scott MacVicar
 
ODP
PostgreSQL: Welcome To Total Security
Robert Bernier
 
PDF
體驗 Hhvm
Chen Cheng-Wei
 
PDF
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Japheth Thomson
 
PDF
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
OVHcloud
 
PDF
Setting up a local WordPress Environment
Chris La Nauze
 
PDF
Gab17 lyon SQL on Linux - David BARBARIN
AZUG FR
 
PDF
[Js hcm] Deploying node.js with Forever.js and nginx
Nicolas Embleton
 
PDF
Passwordless login with unix auth_socket
Otto Kekäläinen
 
PDF
Caching for Cash: Caching
Scott MacVicar
 
PDF
Cent os 5.1 - configuring samba 3.0 to use the ads security mode
B Sasi Kumar
 
PPTX
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 
ODP
How we setup Rsync-powered Incremental Backups
nicholaspaun
 
PPTX
Ansible
Vladimír Smitka
 
PPT
Tips for a Faster Website
Rayed Alrashed
 
PDF
Modern PHP Ch7 Provisioning Guide 導讀
Chen Cheng-Wei
 
PPT
Roy foubister (hosting high traffic sites on a tight budget)
WordCamp Cape Town
 
PBX on a non-specialized distro
StefanoFancello
 
StackiFest16: What's Next in Stacki - Mason Katz
StackIQ
 
A Better WordPress Workflow with WP-CLI
Rikesh Ramlochund
 
Caching for Cash: Benchmarking and Profiling
Scott MacVicar
 
PostgreSQL: Welcome To Total Security
Robert Bernier
 
體驗 Hhvm
Chen Cheng-Wei
 
Migrating a Site Quickly with SSH and WP-CLI (It's not as scary as you think!)
Japheth Thomson
 
Web agencies: An analysis of the OVH infrastructure to optimise your web proj...
OVHcloud
 
Setting up a local WordPress Environment
Chris La Nauze
 
Gab17 lyon SQL on Linux - David BARBARIN
AZUG FR
 
[Js hcm] Deploying node.js with Forever.js and nginx
Nicolas Embleton
 
Passwordless login with unix auth_socket
Otto Kekäläinen
 
Caching for Cash: Caching
Scott MacVicar
 
Cent os 5.1 - configuring samba 3.0 to use the ads security mode
B Sasi Kumar
 
WordPress + NGINX Best Practices with EasyEngine
NGINX, Inc.
 
How we setup Rsync-powered Incremental Backups
nicholaspaun
 
Tips for a Faster Website
Rayed Alrashed
 
Modern PHP Ch7 Provisioning Guide 導讀
Chen Cheng-Wei
 
Roy foubister (hosting high traffic sites on a tight budget)
WordCamp Cape Town
 

Similar to How to turn any dynamic website into a static site | 24.01.2018 | Artem Daniliants | LumoSpark (20)

PDF
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Ortus Solutions, Corp
 
ODP
Caching and tuning fun for high scalability
Wim Godden
 
PPT
Tech X Virtualization Tips
Youssef EL HADJ
 
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
PPTX
Oscon 2011 - ATS
Leif Hedstrom
 
PDF
Nginx pres
James Fuller
 
PDF
Automação do físico ao NetSecDevOps
Raul Leite
 
PPTX
Compcon 2016 Workshop
Steven Cooper
 
PDF
Automation day red hat ansible
Rodrigo Missiaggia
 
PDF
Chap 19 web
Kenny (netman)
 
PPT
Python Deployment with Fabric
andymccurdy
 
DOCX
How to install and configure LEMP stack
RootGate
 
PDF
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Dropsolid
 
PPTX
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX, Inc.
 
PDF
Nginx + PHP
Wataru OKAMOTO
 
PDF
Making Spinnaker Go @ Stitch Fix
Diana Tkachenko
 
PPTX
Building cloud stack at scale
ShapeBlue
 
PPTX
Learn nginx in 90mins
Larry Cai
 
PDF
NGINX Can Do That? Test Drive Your Config File!
Jeff Anderson
 
PDF
Linux sever building
Edmond Yu
 
ITB2019 NGINX Overview and Technical Aspects - Kevin Jones
Ortus Solutions, Corp
 
Caching and tuning fun for high scalability
Wim Godden
 
Tech X Virtualization Tips
Youssef EL HADJ
 
Running Docker in Development & Production (#ndcoslo 2015)
Ben Hall
 
Oscon 2011 - ATS
Leif Hedstrom
 
Nginx pres
James Fuller
 
Automação do físico ao NetSecDevOps
Raul Leite
 
Compcon 2016 Workshop
Steven Cooper
 
Automation day red hat ansible
Rodrigo Missiaggia
 
Chap 19 web
Kenny (netman)
 
Python Deployment with Fabric
andymccurdy
 
How to install and configure LEMP stack
RootGate
 
Drupaljam 2017 - Deploying Drupal 8 onto Hosted Kubernetes in Google Cloud
Dropsolid
 
NGINX: Basics & Best Practices - EMEA Broadcast
NGINX, Inc.
 
Nginx + PHP
Wataru OKAMOTO
 
Making Spinnaker Go @ Stitch Fix
Diana Tkachenko
 
Building cloud stack at scale
ShapeBlue
 
Learn nginx in 90mins
Larry Cai
 
NGINX Can Do That? Test Drive Your Config File!
Jeff Anderson
 
Linux sever building
Edmond Yu
 
Ad

More from LumoSpark (9)

PDF
Getting started with HTTPS | LumoSpark webinar
LumoSpark
 
PDF
Разработка статических сайтов | Artem Daniliants | LumoSpark
LumoSpark
 
PPTX
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
LumoSpark
 
PDF
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
LumoSpark
 
PDF
Going back to static html sites / Artem Daniliants / LumoSpark
LumoSpark
 
PDF
Marketing automatisation (Artem Daniliants)
LumoSpark
 
PDF
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 
PDF
Good front end - bad front-end (Vladimir Gutorov)
LumoSpark
 
PDF
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
LumoSpark
 
Getting started with HTTPS | LumoSpark webinar
LumoSpark
 
Разработка статических сайтов | Artem Daniliants | LumoSpark
LumoSpark
 
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
LumoSpark
 
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
LumoSpark
 
Going back to static html sites / Artem Daniliants / LumoSpark
LumoSpark
 
Marketing automatisation (Artem Daniliants)
LumoSpark
 
Web development automatisation for fun and profit (Artem Daniliants)
LumoSpark
 
Good front end - bad front-end (Vladimir Gutorov)
LumoSpark
 
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
LumoSpark
 
Ad

Recently uploaded (20)

PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PPTX
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PDF
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
AVL ( audio, visuals or led ), technology.
Rajeshwri Panchal
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
State-Dependent Conformal Perception Bounds for Neuro-Symbolic Verification
Ivan Ruchkin
 
The Future of Artificial Intelligence (AI)
Mukul
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
NewMind AI Weekly Chronicles – July’25, Week III
NewMind AI
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 

How to turn any dynamic website into a static site | 24.01.2018 | Artem Daniliants | LumoSpark