title: Installing TextBelt on my own server
body: <p>I want to install <a href="https://github.com/typpo/textbelt" rel="nofollow noreferrer">TextBelt</a>, an open source cURL SMS API, to my own Amazon EC2 web server and use it to send text messages. However, I'm unsure about how to properly go about this. </p>
  
  <p>I used <code>git</code> to clone all the files to a directory called <code>/var/www/textbelt</code>. I then used <code>npm</code> to install all of the dependencies listed in <code>package.json</code> file and created the symlink, as per the directions provided in <a href="https://stackoverflow.com/a/8374526/634324">this</a> answer. I saw that there's a bash script <code>start.sh</code> in the "scripts" folder, so i cd'ed into it and ran <code>sh start.sh</code>. I then got the following message:</p>
  
  <pre><code>nohup: appending output to ‘/home/ec2-user/nohup.out’
  </code></pre>
  
  <p>Naturally, I checked the log, and saw this:</p>
  
  <pre><code>^[[0;31mError: Cannot find module '/var/www/textbelt/scripts/app.js'
      at Function.Module._resolveFilename (module.js:338:15)
      at Function.Module._load (module.js:280:25)
      at Function.Module.runMain (module.js:497:10)
      at startup (node.js:119:16)
      at node.js:906:3
  </code></pre>
  
  <p>For some reason <code>start.sh</code> references the <code>app.js</code> path incorrectly. I fixed this by changing <code>app.js</code> to <code>../app.js</code>, and tried again. This is my complete output:</p>
  
  <pre><code>^[[0;42m    hotnode ^[[m ^[[0;32mnode process restarted^[[m
  ^[[0;31mconnect.multipart() will be removed in connect 3.0
  ^[[m
  ^[[0;31mvisit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
  ^[[m
  ^[[0;31mconnect.limit() will be removed in connect 3.0
  ^[[m
  Listening on 9090
  ^[[0;31m
  ^[[m
  ^[[0;31mevents.js:72
  ^[[m
  ^[[0;31m        throw er; // Unhandled 'error' event
  ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m ^[[m
  ^[[0;31m^^[[m
  ^[[0;31m
  ^[[m
  ^[[0;31mError: Redis connection to localhost:6379 failed - connect ECONNREFUSED
      at RedisClient.on_error (/var/www/textbelt/node_modules/redis-url/node_modules/redis/index.js:196:24)
      at Socket.&lt;anonymous&gt; (/var/www/textbelt/node_modules/redis-url/node_modules/redis/index.js:106:14)
      at Socket.emit (events.js:95:17)
      at net.js:440:14
      at process._tickCallback (node.js:419:13)
  ^[[m
  </code></pre>
  
  <p>After Googling "Redis connection to..failed", I found <a href="https://stackoverflow.com/questions/8754304/redis-connection-to-127-0-0-16379-failed-connect-econnrefused">this</a> answer which suggested that the solution was to start the Redis server by typing <code>redis-server</code>. However, I get the following error:</p>
  
  <pre><code>-bash: redis-server: command not found
  </code></pre>
  
  <p>This suggests that redis was not installed properly. However, after looking at my <code>node_modules</code> folder, I see that there is indeed  a <code>redis-url</code> folder inside, which (I'm assuming) means that the dependency was properly installed? Do I have to do a server-wide install or something?</p>
  
  <p>I'm kinda stuck here.</p>
  
  <p>Overall, I am not sure if I am proceeding in the right direction. What is the proper way to install and start up the TextBelt API to get it running properly.</p>
  
  <p><strong>Update:</strong> Alright, so I figured out that I had to also install the <code>redis</code> server separately. Restarted everything, the logs look good now:</p>
  
  <pre><code>^[[0;42m    hotnode ^[[m ^[[0;32mnode process restarted^[[m
  ^[[0;31mconnect.multipart() will be removed in connect 3.0
  ^[[m
  ^[[0;31mvisit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
  ^[[m
  ^[[0;31mconnect.limit() will be removed in connect 3.0
  ^[[m
  Listening on 9090
  </code></pre>
  
  <p>However, I believe that further configuration is required to actually send a text message. For example, I tried using cURL to send a message using my server, just as I would to <a href="http://textbelt.com" rel="nofollow noreferrer">http://textbelt.com</a>:</p>
  
  <pre><code>$ curl http://my.ip/text \ 
  -d number=5551234567 \ 
  -d "message=I sent this message for free with textbelt.com"
  </code></pre>
  
  <p>But this did not work (all I got was the HTML of my 404 not found page). One thing to note is that I currently have the <code>textbelt</code> folder in <code>/var/www/</code>, but the web document root is in <code>/var/www/html/</code>. I don't think that I have to actually move the folder to the document root, is this correct? How do I need to proceed?</p>