For anyone looking to do this, I wouldn’t recommend starting with a full LAMP stack unless it’s necessary. I also wouldn’t start with trying to run a brand new 22.04LTS version of Ubuntu. Start with 18.04LTS and a simple Nginx implementation. Do server security hardening steps including the TCP/IP stack, installing an SSH key, enabling SSH login on a non-standard port above 16556 and hardening sshd_config and sysctl.conf. Login to your device remotely on your local network (use it directly if you must)… then you can start on the website.
Buy a domain from Google for $5. Configure Nginx, including proper permissions. Configure Google Domains with a DNS A Name pointing at the external IP address of your home router. Google “What’s my IP?” from a machine connected to your home router to get it and be sure you don’t have a VPN enabled when you do or you’ll get the VPN’s IP. Enable port forwarding on your home router to the internal IP of the machine hosting that will host the website, forward ports 80 and 443 TCP/UDP (for HTTP and HTTPS). When all this is done… Install your SSL Certificate and configure to Redirect All Traffic to 443 HTTPS.
Put your domain name into your favorite browser and that should be it. Try it from devices not connected to your home router, like a cellphone with wifi off.
To troubleshoot, use:
sudo nginx -t
sudo systemctl status nginx
sudo journalctl -xe
You can highlight and google the errors in the journal, but everything should work. When it loads, head over to a security audit @ SSLLabs ssllabs.com/ssltest Adjust and retest as needed.
Have fun and enjoy!!!
Links and Commands:
Security Hardening and SSH Configuration
TCP Stack Hardening
File and Directory Permissions for a Server
Installing and Configuring Nginx
If you get to the point you want a full stack, there are more instructions following this article for that
SSL Cert Installation for HTTPS
Domain Security Audit
Most commands accept --help as a parameter:
ifconfig #get internal IP addresses and DHCP information
netstat -an #active connection information
ping google.com #exit with ctrl-c