Chapter 10: Dynamic Website Hosting (PHP, Python, Node.js with MySQL)
Common Mistakes I See Students Make
- Hard-coding passwords in code and pushing to GitHub. Use
.envfiles with permission 600 and add them to.gitignore. - Using
localhostin Node.js and gettingECONNREFUSED ::1:3306. Use127.0.0.1. - Running the app with
node app.jsin the SSH session and closing the terminal — the app dies. Use pm2 or systemd. - Running both pm2 and a systemd unit for the same app → port 3000 already in use.
- Opening port 3306 or 3000 to the internet instead of using the reverse proxy.
- Forgetting
setsebool -P httpd_can_network_connect 1on CentOS → 502 Bad Gateway. - Not restarting PHP-FPM/Apache after installing PHP modules.