Google App Engine – running on a remote linux box (VPS)

So, you’ve been working on a Google App Engine project on your VPS and for some reason, when you type the following command: <projectfolder>

it works, but when you try to access it in your browser from the client machine (your personal PC or laptop from where you’ve ssh’d into), it doesn’t work or gives you a “Connection Timed Out” error.

There are 2 things you need to check when this happens:

  1. IPTables – check whether you’ve opened up the port on which the local app server is working on
  2. App Server host name and port settings

For IPTables, you just need to make sure the correct rules are set. Since my app server will be running on port 8080, I had to check to see if that port was open or not. The ports can be checked with the following command:

┬ásudo iptables -nvL –line-numbers

If you don’t see port 8080 opened on the INPUT list, you’ll need to open it.

IPTables works from top to bottom. So, usually, the last entry is to reject everything that doesn’t fit. So, you might need to add the rule in between and for this we use the -I argument. For example, if I want to make this rule the 4th entry in my INPUT list (I have 5 rules), this can be done with the following command:

sudo iptables -I INPUT 4 -p tcp –dport 8080 -j ACCEPT

This should fix the iptables part of things.

Next, we need to fix the app server host and port values. By default app engine server runs on localhost and port 8080. Let’s change that to work with the external IP address of the Linux box and fix it to port 8080: <projectfolder> –host –port 8080

And now, if you visit, it should work!

Setting up a website in home directory instead of /var/www

I have an Apache web server set up with cakephp as the framework on Ubuntu. But I got bugged very quickly at having to sudo to edit every file since they were placed in /var/www. Besides, it didn’t strike me as the right thing to do.

So, a quick google on “/var/www on ubuntu” took me to this page which turned out to be exactly what I was looking for. You can set it up so that http://localhost points to a folder in your home directory (/home/user/public_html). Now I can edit all files without sudo and it works with http://localhost.