Deploying Applications
Registering a Domain Name
- Make it memorable
- Shorter is better
- Most registrars charge £10 - £12 per year
Server for Applications
- use a small computer you own
- Use a shard host with the domain registrar of Platform as a service
- Advantages
- Server is preconfigured
- Simple to use
- Disadvantages
- Large cost as scale
- Limited control over software stack
- May not be able to run certain messages e.g Message Queues
- Advantages
- Use a cloud based virtual server
- Advantages
- Can have fill control over the software stack
- Cheap to run
- Disadvantages
- Security can be your problem
- Limited Hardware
- Advantages
- Buy a server and find a data centre
- Advantages
- Free Hardware choice
- Full software choice
- Disadvantages
- Security
- Cost
- Advantages
- Build you own data centre
- Disadvantages
- Expensive
- Disadvantages
Software Stack Choices
Database options include
- mySQL
- PostgreSQL
Many different versions Don’t use SQLite3
Webserver Apache / nginx are both good choices
Configuring the System
After the OS is installed the software stack can be installed form the source or with a package manager
- Install apache
apt-get install apache2
- Setup the virtual
host file in /etc/apache2/sites-available/example.com
- Create the directories
/srv/www/example.com/public_html
andlogs
- Enable the sire
a2ensite example.com
- Reload apache
service apache reload
Installing mysql
apt-get install mysql-server
- Secure the basic installation
mysql_secure_installation
- Start a database session
mysql -u root -p
- Create a user for the application
- Create a database for you application
- Grant privileges for your application
Installing PHP
apt-get install php8.0 php8.0-mysql
- restart apache
service apache2 reload
Additional Software
- Imagemagik - Manipulating uploaded images
- sendmail - Acts as a mail server
- logrotate - To rotate the log files and delete old ones
Updating the DNS
- Got to the registrar and register the IP address with the Domain Name
- Add a record for
www.
which points to the server - Save changes
- It can take some time for any changes to propagate
Securing the Server
As a minimum always
- Install
fail2ban
blocks ssh users form an IP for failed logins - Configure the firewall to only accept SSH and HTTP(s) traffic
- Modify SSH to only accept key based logins from non designated IPs
Maintenance
- Keep an eye on the server
- Need to install monitoring Software to alert you to issues
- Check logs on a daily basis
- Setup an email script
- Monitor usage to ensure everyone can use the site