Chapter 11: Application Hosting — WordPress, Flask and Express
Interview Questions
- Q1. What are the steps to host WordPress on an EC2 instance?
- Install web server + PHP + MySQL/MariaDB, create DB and user, download and extract WordPress, configure
wp-config.phpwith DB details and salts, set ownership/permissions, configure a vhost with URL rewriting, then complete the web installer. - Q2. Why use Nginx in front of Gunicorn?
- Nginx handles slow clients, TLS, compression and static files efficiently and buffers requests, while Gunicorn focuses on running Python code.
- Q3. What does
wsgi:appmean in a Gunicorn command? - Import the module
wsgi(wsgi.py) and use the object namedappas the WSGI application. - Q4. How many Gunicorn workers should you run?
- A common starting point is (2 × CPU cores) + 1, then tune based on load and memory.
- Q5. What is the difference between
pm2 restartandpm2 reload? restartkills and restarts processes (brief downtime).reloadrestarts cluster workers one by one for zero downtime.- Q6. How do you make pm2 apps start after a reboot?
- Run
pm2 startup(and execute the printed command), thenpm2 saveto store the current process list.