{"_id":"5628ed9b48742a0d00474591","__v":20,"project":"54cf411f9d09bb0d00a17a1c","version":{"_id":"54cf411f9d09bb0d00a17a1f","project":"54cf411f9d09bb0d00a17a1c","__v":14,"createdAt":"2015-02-02T09:19:27.656Z","releaseDate":"2015-02-02T09:19:27.656Z","categories":["54cf41209d09bb0d00a17a20","54cfb99bbba1a023008741af","54cfb9a65ff7e617002bbd7f","54cfba03bba1a023008741b6","54cfba0ebba1a023008741b8","54cfba19bba1a023008741b9","54cfba29bba1a023008741bb","54cfba345ff7e617002bbd87","54cfba3ebba1a023008741bc","54cfba473995cf0d0006f6f0","54e371b18ef7552300409bf2","54e37aa5e887c50d005ef629","555a4e9b147f91190092d137","56b0e91802f4bc0d006ce254"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"54dd95e5c4a3570d009d490c","parentDoc":null,"category":{"_id":"54cfba19bba1a023008741b9","__v":24,"pages":["54d0351994f7980d0081b848","54d03542c795960d009f4219","54d0357d94f7980d0081b84b","54d039c3f530ca0d0005396a","54d039e394f7980d0081b859","54d03a1294f7980d0081b85b","54d03a3bf530ca0d0005396e","54d03a9294f7980d0081b85e","54d03abdc795960d009f4220","54d03ade94f7980d0081b860","54d03b02f530ca0d00053970","54d03b3794f7980d0081b862","54d03b69f530ca0d00053973","54d03b8994f7980d0081b864","54d03bb1c795960d009f4222","54d8f49e6a09052100a6b60e","54ec495d7ab3172d00c01a92","54ec6f2ec0c0ba1700386fa6","54f6f3f852174719008f6168","5628ed9b48742a0d00474591","564b714fcc472d0d00da941e","564b9e65288b1a2b00b3ae7d","564ba4872cabb82100943f0d","56995b3e54d7db17000ee9e6"],"project":"54cf411f9d09bb0d00a17a1c","version":"54cf411f9d09bb0d00a17a1f","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-02T17:55:37.930Z","from_sync":false,"order":4,"slug":"running-and-debugging","title":"Running and Debugging"},"updates":["586a5446e02cce1b007b5a29","586a5470eaeaa139004cfd6f","586a549a77d9422700b0db66"],"next":{"pages":[],"description":""},"createdAt":"2015-10-22T14:07:23.158Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"Cloud9 hosted workspaces now allow workspaces to listen on multiple ports. The following ports are supported (along with the urls they can be accessed from):\n\n- 8080 -> `https://<workspacename>-<username>.c9users.io`\n- 8081 -> `http://<workspacename>-<username>.c9users.io:8081`\n- 8082 -> `http://<workspacename>-<username>.c9users.io:8082`\n\nThis allows things like running multiple applications on a workspace and [LiveReload](https://www.npmjs.com/package/livereload). \n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"How to get Livereload to work with your app\",\n  \"body\": \"If you're using Grunt with LiveReload, please checkout an example [here](https://github.com/cloud9ide/livereload-example)\"\n}\n[/block]\n## How to use multiple ports with Apache\n\nApache comes pre-installed with each Cloud9 workspace. This way, it is super easy to get started and serving your HTML pages. However, if you'd like to run multiple applications on different ports, here's what you can do: (This is for port 8081 but it's exactly the same for port 8082)\n\n- Create a new configuration in `/etc/apache2/sites-available`\n```\nsudo -i\ncd /etc/apache2/sites-available\ncp 001-cloud9.conf 002-myconfig.conf\n```\n\n- Link configuration in `/etc/apache2/sites-enabled` \n```\ncd /etc/apache2/sites-enabled\nln -s /etc/apache2/sites-available/002-myconfig.conf\n```\n\n- Edit `002-myconfig.conf` and change the port number from 8080 to 8081. Set DocumentRoot to whatever path you'd like apache to serve when your project is accessed on port 8081\n\n- Edit `/etc/apache2/ports.conf` and add `Listen 8081` just below `Listen 8080`\n\n- Restart apache with `sudo service apache2 restart` or by restarting the runner. \n\n- Access your new instance of apache at http://<workspacename>-<username>.c9.io:8081\n\n## How to run PHPMyAdmin at the same time as your NodeJS, Ruby on Rails or other application\n\nPHPMyAdmin uses Apache to run. So previously you couldn't have both it and NodeJS/Rails/Python running at the same time as they both wanted port 8080. \n\nFirst [Set Up PHPMyAdmin](doc:setting-up-phpmyadmin). Then do one of the following:\n\n### Run PHPMyAdmin on port 8080 and Application on 8081\n\nThis is the simplest way. All you need to do is specify 8081 as your app port instead of using the environment variable $PORT. Then you can access your app at https://projectname-username.c9users.io:8081/ ad PHPMyAdmin at  http://<workspacename>-<username>.c9.io/phpmyadmin\n\n### Run PHPMyAdmin on port 8081\n\nThe other alternative is to run Apache on port 8081. You can do this with the following steps:\n\n- Edit `/etc/apache2/ports.conf` and change 8080 to 8081\n- Edit `/etc/apache2/sites-available/001-cloud9.conf` and change 8080 to 8081. \n- Restart apache with `sudo service apache2 restart` or by restarting your runner. \n\nYou'll then be able to access PHPMyAdmin at https://<workspacename>-<username>.c9users.io:8081/phpmyadmin\n\n### Extra Information\n\nIf you make apache listen on multiple ports PHPMyAdmin will actually be available at /phpmyadmin for every port.","excerpt":"Running applications on different ports with Cloud9","slug":"multiple-ports","type":"basic","title":"Multiple Ports"}

Multiple Ports

Running applications on different ports with Cloud9

Cloud9 hosted workspaces now allow workspaces to listen on multiple ports. The following ports are supported (along with the urls they can be accessed from): - 8080 -> `https://<workspacename>-<username>.c9users.io` - 8081 -> `http://<workspacename>-<username>.c9users.io:8081` - 8082 -> `http://<workspacename>-<username>.c9users.io:8082` This allows things like running multiple applications on a workspace and [LiveReload](https://www.npmjs.com/package/livereload). [block:callout] { "type": "info", "title": "How to get Livereload to work with your app", "body": "If you're using Grunt with LiveReload, please checkout an example [here](https://github.com/cloud9ide/livereload-example)" } [/block] ## How to use multiple ports with Apache Apache comes pre-installed with each Cloud9 workspace. This way, it is super easy to get started and serving your HTML pages. However, if you'd like to run multiple applications on different ports, here's what you can do: (This is for port 8081 but it's exactly the same for port 8082) - Create a new configuration in `/etc/apache2/sites-available` ``` sudo -i cd /etc/apache2/sites-available cp 001-cloud9.conf 002-myconfig.conf ``` - Link configuration in `/etc/apache2/sites-enabled` ``` cd /etc/apache2/sites-enabled ln -s /etc/apache2/sites-available/002-myconfig.conf ``` - Edit `002-myconfig.conf` and change the port number from 8080 to 8081. Set DocumentRoot to whatever path you'd like apache to serve when your project is accessed on port 8081 - Edit `/etc/apache2/ports.conf` and add `Listen 8081` just below `Listen 8080` - Restart apache with `sudo service apache2 restart` or by restarting the runner. - Access your new instance of apache at http://<workspacename>-<username>.c9.io:8081 ## How to run PHPMyAdmin at the same time as your NodeJS, Ruby on Rails or other application PHPMyAdmin uses Apache to run. So previously you couldn't have both it and NodeJS/Rails/Python running at the same time as they both wanted port 8080. First [Set Up PHPMyAdmin](doc:setting-up-phpmyadmin). Then do one of the following: ### Run PHPMyAdmin on port 8080 and Application on 8081 This is the simplest way. All you need to do is specify 8081 as your app port instead of using the environment variable $PORT. Then you can access your app at https://projectname-username.c9users.io:8081/ ad PHPMyAdmin at http://<workspacename>-<username>.c9.io/phpmyadmin ### Run PHPMyAdmin on port 8081 The other alternative is to run Apache on port 8081. You can do this with the following steps: - Edit `/etc/apache2/ports.conf` and change 8080 to 8081 - Edit `/etc/apache2/sites-available/001-cloud9.conf` and change 8080 to 8081. - Restart apache with `sudo service apache2 restart` or by restarting your runner. You'll then be able to access PHPMyAdmin at https://<workspacename>-<username>.c9users.io:8081/phpmyadmin ### Extra Information If you make apache listen on multiple ports PHPMyAdmin will actually be available at /phpmyadmin for every port.