2

Is it possible to run serve my web application from another server than the one provided in cloud9? For example : I would like to run different applications (PHP, Node.js - not sure what's possible yet) with nginx as the backend server (i) and/or a reverse proxy (ii) (to try different scenarios and configuration options).

  1. Is it possible to run nginx and serve content to the outside world in cloud9?
  2. Is it possible to have nginx as a reverse proxy in cloud9?

EDIT:

Here they write:

$PORT is exposed to the outside: When you run an application which listens on the port specified in the environment variable $PORT, you can access this application using the http://projectname.username.c9.io URL scheme. The proxy expects the server on that port to be a HTTP server. Other protocols are not supported.

This leads me to believe that if I would start nginx on port=$PORT it would be accesible via the specified URL sheme - can anyone confirm? Maybe anyone has tried this and can share some time-saving tips. Thanks.

Mindaugas Bernatavičius
  • 3,757
  • 4
  • 31
  • 58

2 Answers2

5

I know this might be a late reply but might be helpful for those who are wondering how to do the same.

Short answer
I've created a repository to hold all the configuration needed on the process. Just run a command and NGINX and PHP-FPM will be serving and accessible from internet.
GitHub repo: https://github.com/GabrielGil/c9-lemp

Explanation
Basically to run NGINX on a c9 environment as you noted, you just have to make it listen on port 8080. YOu can either edit the default site on /etc/nginx/sites-available or create and enable your own (That's what the script above does)

Then, in order to run PHP-FPM script using NGINX, configure some permissions and the socket on the webserver is needed. By default, c9 uses ubuntu:ubuntu and the webserver www-data:www-data.
The script above also does this changes for you.

Hope this help you, or other users on similar situations.

Gabriel G.
  • 731
  • 9
  • 15
2

You can run nginx on a normal Cloud9 workspace, as long as it listens to port 8080 (the value of $PORT). The URL scheme to reach your server would be http://projectname-username.c9.io, however. Please refer to the docs.c9.io for more up-to-date help on running applications.

One other thing you can do if you have another server where you would like to host your software, is to create an ssh workspace (https://docs.c9.io/ssh_workspaces.html). That way, you can connect Cloud9 to an external server directly.

lennartcl
  • 578
  • 4
  • 11
  • Thanks for the answer. It does not seem like it's possible - I have configured nginx for port 8080, verified that $PORT is 8080 - still see "some problems here" error page. – Mindaugas Bernatavičius Dec 01 '14 at 17:58
  • In principle the approach is sound. If it doesn't work I would contact Cloud9 support at https://c9.io/support. – lennartcl Dec 04 '14 at 09:51