Use AWS Cloud9 to create an EC2 instance
- set to Ubuntu
- once complete open IDE
- create
info.phpand anindex.php
This also will set the view to an elastic IP
In AWS veiw EC2 > instances
- click on instance and name it
- note
public IPandsubnet
In tabs below instances
- click link next to security goups
- click tab for Inbound
- click edit
- Add Rule
type : Custom TCP Rule
Port Range : 8080
Source : Anywhere
Go to services and search VPC
- once there click subnets
- select the subnet from the note earlier
- click on Network ACL tab
- Look at inbound rules
- if a rule doesn't already exsist where type is HTTP (8080)
- create rule with
Type : Custom TCP Rule
Port : 8080
Source : 0.0.0.0/0
Allow/Deny : ALLOW
so IP does not change when restarting instance
- visit Netsir & Security > Elastic IPs from the EC2 Dashboard
- Click Allocate new address
- IPv4 address pool : Amazon Pool
- Close
- select Elastic IP
- Actions > Associate Address
- Resource Type : Instance
- Instance : the instance
- private IP : private IP of instance
Reboot instance from actions > instance state > reboot on instances page
You can now view the instance from http://[elastic IP]:8080
The instance should come with Apache, PHP, MYSQL already installed. But.. you never know..
$ apache2 -v
$ php -v
usually the server will look for index.html first if you want it to look for index.php first...
$ sudo vim /etc/apache2/mods-enabled/dir.conf
in file move index.php to front of list like below
<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>
then restart apache
$ sudo systemctl restart apache2
we may need some modules such as curl for google reCaptcha
See list of modules
$ sudo apt-cache search php- | less
//if php-curl is listed skip if not look into installing for version of PHP installed
$ mysql --version
run
$ sudo mysql_secure_installation
- set new password for root user
- confirm new password
- For the rest of questions, just type
yand hitENTER. This will remove anonymous user, disallow root user login remotely and remove test database.
change authentication method from auth_socket to mysql_native_password this will help with phpmyadmin
$ sudo mysql
//run to check the current authentication method
$ SELECT user,authentication_string,plugin,host FROM mysql.user;
If root is set to auth_socket under plugin
run this command to change the authentication to mysql_native_password
$ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '[password]';
$ FLUSH PRIVILEGES;
// check again to make sure it worked
$ SELECT user,authentication_string,plugin,host FROM mysql.user;
$ exit