Home > HowTo, Linux > Amazon WordPress / Lighttpd / Varnish

Amazon WordPress / Lighttpd / Varnish

December 19th, 2012 Leave a comment Go to comments

Amazon WordPress / Lighttpd / Varnish for free

#1. Create an AWS Account

You can sign up here. You’ll have to provide a credit card and a phone number where you will be called as part of the online registration process for verification purposes. Amazon offers a Free Usage Tier, which is great to explore the services and even host real apps without being charged. Check the details here.

#2. Create an Instance

To create a new instance, access the AWS Management Console and click the EC2 tab: (ATENTION ON THE STARS, those are FREE)
Choose an AMI in the classic instance wizard: I chose the Basic 64-bit Ubuntu
Instance details: Select the Instance Type : Micro (free)
Create a new key pair. Enter a name for your key pair and download your key pair
Select the quick start security group.
Launch your instance.

#3. Login to the server
ssh -i certificate.pem ubuntu@<DNS_Public_name>
sudo -i

#4. Change the passwords
passwd ubuntu
passwd root

#5. Update the OS
apt-get upgrade && apt-get upgrade

#6. Fix the SSH so it will ask for password instead of the certificate
cp -v /etc/ssh/sshd_config  /etc/ssh/sshd_config.bkp
cat > /etc/ssh/sshd_config  <<EOF
Protocol 2
HostKey /etc/ssh/ssh_host_key
HostKey /etc/ssh/ssh_host_rsa_key
ServerKeyBits 1024
SyslogFacility AUTHPRIV
LogLevel INFO
LoginGraceTime 34m
PermitRootLogin no
MaxAuthTries 5
MaxSessions 10
RSAAuthentication yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
X11Forwarding yes
Subsystem    sftp    /usr/libexec/openssh/sftp-server
UseDNS no
EOF

/etc/init.d/ssh restart

Note: Keep this session and in paralel try to ssh into the server like ssh ubuntu@<server>

#7. Disable apparmor (its like selinux on RedHat)
/etc/init.d/apparmor stop && sudo update-rc.d -f apparmor remove

#8. Change the hostname
vi /etc/hostname
vi /etc/hosts
/etc/init.d/host stop && /etc/init.d/host start

#9. Fix the time
vi /etc/timezone

#10. Reboot
reboot

#############################################
#11- Install  LIGHTPD / MYSQL / WORDPRESS

Pre-Requisites
apt-get install php5-cli php5-cgi php5-mysql lighttpd mysql-server

cd /etc/lighttpd
cp -v /etc/lighttpd/conf-available/15-fastcgi-php.conf /etc/lighttpd/conf-available/

$HTTP[“host”] == “<AMAZON_DNS_NAME>” {
server.document-root        = “/var/www/wordpress”
server.error-handler-404    = “/index.php”
server.errorlog             = “/var/log/lighttpd/site_error.log”
accesslog.filename          = “/var/log/lighttpd/site_access.log”
url.rewrite-final = (
# Exclude some directories from rewriting
“^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)” => “$0”,
# Exclude .php files at root from rewriting
“^/(.*.php)” => “$0”,
# Handle permalinks and feeds
“^/(.*)$” => “/index.php/$1”
)
}

Install wordpress
cd /var/www
wget “http://wordpress.org/latest.tar.gz”

#7. Create WordPress DB
mysql -u root -p

mysql> CREATE DATABASE wordpress;
mysql> CREATE USER word_user;
mysql> SET PASSWORD for word_user = PASSWORD(“My_Blog_2013”);
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO “word_user”@”localhost” IDENTIFIED BY “My_Blog_2013”;
mysql> FLUSH PRIVILEGES;

WordPress Configuration
cp -v /var/www/wordpress/wp-config-sample.php /var/www/wordpress/wp-config.php && vi /var/www/wordpress/wp-config.php
Update the MySQL settings
DB_NAME: Database Name used by WordPress
DB_USER: Username used to access Database
DB_PASSWORD: Password used by Username to access Database
DB_HOST: The hostname of your Database Server
And also put your Authentication Unique Keys and Salts under the section labeled Authentication Unique Keys using WordPress’ online generator to obtain them:
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
NONCE_KEY
Copy and paste from https://api.wordpress.org/secret-key/1.1/salt/

/etc/init.d/lighttpd restart

Try to acess the site

ref.
http://www.cyberciti.biz/tips/category/lighttpd
https://help.ubuntu.com/community/AppArmor

Installing WordPress 3.0 on Ubuntu 10.04 (Lucid Lynx)


https://calomel.org/lighttpd.html
http://yourneighbours.de/writings/run-a-blazing-fast-website-on-lighttpd-with-wordpress/

  1. No comments yet.
  1. No trackbacks yet.

VAMOVE *

*