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

Jan 31 2010 Published by Eneko Alonso under uncategorized

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 :)

One response so far

Got new servers on Rackspace Cloud

Jan 30 2010 Published by Eneko Alonso under uncategorized

Last night I got an account at Rackspace Cloud and created three brand new CentOS Linux servers. Now I have to set them up: two web servers and one database server. My goal: Move Spaniards.es website to this new hosting.

Why move?

Currently I am hosting Spaniards.es on two dedicated servers at Ace-Host.net. So far, so good, but the site has started to get slow (more the web server than the db server, which is running great so far). Some days I found the site running at 30 times the processor capacity (according to ‘top’), which is a lot. The biggest problem I have right now is the caching on the web server. I have installed both XCache and Memcached, but can get them to work since that server was my first ever dedicated server an has a CPanel installation that drives me nuts.

Sooner or later I had to move that webserver into a new clean installation, but I have decided that if I have to move, I’ll do it to a cloud. No more dependencies on a physical hardware, no more worries.

Why not EC2

Well, I’ve ried EC2 and it is not that I don’t like it. It is just that it is so much work. After seeing how CloudServers work on RackSpace, I have no doubt.

When is Spaniards.es going to be moved?

There is no date yet. First I have to set up the servers, make sure everything works fine, set up the domains, dns, mail, etc. Hopefully in a couple of weeks, if I can find enough time to do so.

5 responses so far

Moved research to enekoalonso.com

Jan 11 2009 Published by Eneko Alonso under uncategorized

You shouldn’t notice it, but I have moved all my research demos from dev.enekoalonso.com/research to enekoalonso.com/research. It is just a little change, but will help keeping things more organized, I think.

To avoid breaking old links, I have added a 301 redirect:

  1. Options +FollowSymLinks
  2. RewriteEngine on
  3.  
  4. # For http://dev.enekoalonso.com/research
  5. RewriteCond %{REQUEST_URI} ^/research$
  6. RewriteRule .* http://enekoalonso.com/research [R=301,L]
  7.  
  8. # For http://dev.enekoalonso.com/research/*
  9. RewriteRule (.*) http://enekoalonso.com/research/$1 [R=301,L]

Let me know if you find any issues.

No responses yet

Enabling PHP5 on Mac OS X Leopard

Dec 05 2008 Published by Eneko Alonso under uncategorized

I had done this already at work, but for some reason my MacBook Pro still didn’t “understand” PHP. Well, I’ve decided it’s time to activate it:

  1. # Use your favorite editor
  2. mate /etc/apache2/httpd.conf
  3. # Uncomment the line:
  4. #LoadModule php5_module libexec/apache2/libphp5.so
  5. # Restart apache
  6. sudo apachectl restart

Done.

No responses yet