Skip to content

Instantly share code, notes, and snippets.

@maxoja
Created October 28, 2020 02:36
Show Gist options
  • Save maxoja/e68ac85b03d375fcd1e8dbeda58c428f to your computer and use it in GitHub Desktop.
Save maxoja/e68ac85b03d375fcd1e8dbeda58c428f to your computer and use it in GitHub Desktop.
Personal Server Setup Guide [Nginx, SSL, IONOS, GoDaddy, Crontab]
----------------------------------
Domain Parking for IONOS Server
----------------------------------
- Go to domain & ssl section
- Add external domain
- Use Godaddy's name servers
- Add verify record on GoDaddy
- Add A record on GoDaddy linking to the server IP
* Changing DNS Records takes some time to update depending on TTL
* Can use ultratools.com/tools/dnsLookupResult for checking which dns record is in use
------------------
Enable port
------------------
1. Config firewall rules at hosting provider
2. Use ufw to manage firewall, below are essential commands
> ufw enable
> ufw disable
> ufw status verbose
> ufw allow <your-port>/tcp
-------------------------------
Enable SSL for your server
-------------------------------
next time: might be more convenient to use CertBot for generating certs
1. Activate SSL certificate on IONOS domain dashboard
2. Retrieve private key, certificates and upload to your server
3. Merge server and intermediate .cer files together
> cat server.cer intermediate.cer > bundle.cer
4. Set bundle.cer path in nginx config file
> nano /etc/nginx/sites-available/default
server {
listen 80;
listen 443 ssl;
server_name twnz.dev;
ssl_certificate /etc/nginx/ssl/bundle.cer;
ssl_certificate_key /etc/nginx/ssl/domain_private_key.key;
location / {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
5. Don't forget to restart nginx after changes
> service nginx restart
------------------
Crontab guide
------------------
- Check if cron is running
> ps -ef | grep cron
- Reboot if it's not running
- Check cron job running log
> grep CRON /var/log/syslog
- Edit schedule config file
> crontab -e
- Define task schedule
<trigger> <command>
- Examples <trigger>
- - * * * * * = every minute
- - 5/ * * * * = every minute
- - 30 * * * * = every hour at *.30
- - 0 6,13 * * * = twice a day at 6.00 and 13.00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment