Nginx is a high-performance web server that is used to run and manage websites on a local or live environment. It is known for its speed, stability, and easy configuration. You can easily install and run Nginx to create a local web server environment for testing and learning. It also helps you practice deploying and testing web pages before going live. Here’s what you can do with Nginx in Termux:
- Host local HTML websites on your phone.
- Test and preview web projects before going live.
- Learn how web servers and hosting work.
- Edit and practice server configuration files.
- Run multiple web pages as a mini website setup.
- Combine with PHP and databases for dynamic websites.
Installation Commands
Update and upgrade packages.
pkg update && pkg upgradeInstall Nginx.
pkg install nginxCheck installation.
nginx -vUsage Commands
Start Nginx server.
nginxStop Nginx server.
nginx -s stopRestart Nginx server.
nginx -s restartReload Nginx after configuration changes.
nginx -s reloadCheck if Nginx is running.
ps aux | grep nginxCheck configuration file for errors.
nginx -tKill all Nginx processes (force stop).
pkill nginxStart Nginx in foreground (debug mode).
nginx -g "daemon off;"View error logs.
cat $PREFIX/var/log/nginx/error.logView access logs.
cat $PREFIX/var/log/nginx/access.logEdit Nginx configuration file.
nano $PREFIX/etc/nginx/nginx.confEdit default HTML website file.
nano $PREFIX/share/nginx/html/index.htmlTest and reload configuration safely.
nginx -t && nginx -s reloadOpen web server in browser.
http://127.0.0.1:8080