🚀 Nginx Configuration for asifahmadkhan.com
server {
listen 80; # 🔊 Listen on port 80
listen [::]:80; # 🌍 Support for IPv6
server_name www.asifahmadkhan.com; ## 🌐 DOMAIN NAME
root /var/www/html/index.html; ## 📂 PROJECT PATH
# 📜 Logging
access_log /var/log/nginx/access.log combined buffer=512k flush=1m;
error_log /var/log/nginx/error.log warn;
# 📄 Serve `index.html` fallback
location / {
try_files $uri $uri/ /index.html;
}
# ⚙️ PHP API fallback
location ~ ^/api/ {
try_files $uri $uri/ /index.php?$query_string;
}
}
✅ Make sure to:
- Place this file inside
/etc/nginx/sites-available/
- Create a symlink to
/etc/nginx/sites-enabled/
using:ln -s /etc/nginx/sites-available/asifahmadkhan.com.conf /etc/nginx/sites-enabled/
- Restart Nginx for changes to take effect:
sudo systemctl restart nginx
🚀 Your site is now ready! 🎉