Pre-setup:
- Select Ubuntu server.
- Create new key pair to connect with instance securely.
- After instance setup, connect with your instance
- Open an SSH client.
- Locate your private key file (keyname.pem). The wizard automatically detects the key you used to launch the instance.
- Your key must not be publicly viewable for SSH to work. Use this command if needed:
chmod 400 brand-nation.pem
- Connect to your instance using its Public DNS: ec2-12-345-678-91.compute-1.amazonaws.com
- Example: ssh -i "keyname.pem" ubuntu@ec2-12-345-678-91.compute-1.amazonaws.com
Setup:
- sudo apt-get update
- sudo apt-get dist-upgrade
- sudo apt-get install apache2
- sudo apt-get install mysql-server
- sudo mysql_secure_installation utility
- sudo apt-get install php libapache2-mod-php
- sudo adduser ubuntu www-data
- sudo chown -R www-data:www-data /var/www/html
- sudo chmod -R g+rw /var/www/html
- sudo mysql -u root -p
- sudo a2enmod rewrite
- sudo service apache2 restart
- sudo nano /etc/apache2/sites-available/000-default.conf
#Below “DocumentRoot /var/www/html” add the following lines:
<Directory “/var/www/html”>
AllowOverride All
</Directory>
Common Issues:
- Assign security group to instance, so TCP, HTTP works
- Listing Directory Failed: Connect FTP via SFTP
- MYSQL permission issues (https://support.rackspace.com/how-to/installing-mysql-server-on-ubuntu/)
- Mysql extension is missing in php7 installation. Ubuntu 16.04 (sudo apt-get install php-mysql)
Start server and test:
sudo service httpd start
sudo service mysqld start
chkconfig --list httpd
Top comments (0)