having fun with code

CloudServers: Creating a new web server with httpd, php & memcached

Creating a new web server is piece of cake at Rackspace Cloud. Here is a demo video of how to set up a new instance with your favorite Linux distribution. I have used Fedora 12 for my new spaniards.es servers, and here is the script I’ve used to install everything needed so far:

  1. # Install HTTPD
  2. yum -y install httpd rsync
  3.  
  4. # Install PHP
  5. yum -y install php php-mbstring php-mysql mysql
  6.  
  7. #############################################################
  8. # FIREWALL
  9. # Open http port 80 (and ssh)
  10. iptables -F
  11. iptables -A INPUT -p tcp –dport 22 -j ACCEPT
  12. iptables -P INPUT DROP
  13. iptables -P FORWARD DROP
  14. iptables -P OUTPUT ACCEPT
  15. iptables -A INPUT -i lo -j ACCEPT
  16. iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
  17. iptables -A INPUT -p tcp –dport 80 -j ACCEPT
  18. iptables -L -v
  19. service iptables save
  20.  
  21. # Start HTTPD server
  22. /etc/init.d/httpd start
  23.  
  24. # Install  memcached
  25. yum -y install memcached
  26. memcached -d -u apache
  27. yum -y install php-pecl-memcache
  28.  
  29. # Restart HTTPD server
  30. /etc/init.d/httpd restart

DNS configuration can be done through the admin pages, so there is no need for manual configuration. Copying the data from your old server can be done with rsync and having mysql installed is handy to test db connections from the console.

In less than 10 minutes you can have a new web server up and running :)

Related Posts:

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Additional comments powered by BackType

About the blog

This is a blog about development, focused mainly on Javascript but also other languages like python, shell scripts and more.

About the author

Eneko Alonso is a software engineer and UI developer with more than eight years of experience in software and web development. He lives in San Luis Obispo, California and works at LEVEL Studios.

Contact Info

Contact Info