A practical tutorial and deployment tools for static website hosting on CentOS with Nginx and SSL certificates.
Use these steps to set up your static website locally for testing or development:
-
Clone the repository:
git clone https://github.com/techgeek68/static-site-nginx-centos-ssl.git cd static-site-nginx-centos-ssl
-
Run the setup script:
chmod +x setup.sh sudo ./setup.sh
Note: The script installs and starts Nginx. SSL setup is skipped for localhost.
-
Place your static site files in:
/usr/share/nginx/html
-
Open your browser and visit:
http://localhost
or
http://127.0.0.1
For deploying on a public server with a custom domain and SSL certificate:
-
Edit
setup.sh
, replacingexample.com
with your actual domain:sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
-
Run the setup script:
chmod +x setup.sh sudo ./setup.sh
-
Ensure your DNS records point your domain to your server’s IP.
-
Place your static site files in:
/usr/share/nginx/html
-
Visit your site securely at:
https://yourdomain.com
Note:
Certbot requires a public domain name and working DNS for SSL setup and renewal.
- Automated Nginx installation on CentOS
- Easy setup for static site hosting
- Optional SSL certificate provisioning (Let’s Encrypt)
- Simple instructions for local and public deployment
MIT