Configuring network access to your application
All Rails applications deployed via Cloud 66 use Nginx as a combined web server and reverse proxy. By default traffic will be routed to your application over ports 80 and 443 for HTTP and HTTPS traffic respectively. However, you may need your application to be accessible via a different port. This guide walks you through a basic example of changing the port through which your application is served. What you’ll need
Before you start, please check you have the following:
- A Cloud 66 Account — If you don’t already have one, sign up for a Cloud 66 account. There is a free community plan and you’ll get full unlimited access to all products free for 14 days.
- An existing application set up in Rails — To make the most of this tutorial you need to have a Rails app already set up in Cloud 66. Follow our Getting Started guide if you’re not sure how to do this.
Changing the HTTP port
Let’s imagine that for some reason your application needs to use port 8080 rather than port 80 to serve traffic to the web. To achieve this we will need to override the default settings in Nginx. To do this:
- Open the Application Overview from your Dashboard
- Click on Configuration in the Application panel on the right of the screen
- Click on the Configuration Files tab and then on the NGINX sub-tab
- Scroll through the configuration file until you find the
listenand change the value from
- Click the green Preview button to parse your updated configuration
- Check the file, then add a commit message and click Commit to Server
If you now return to Application Overview and click on the visit site link, the page should fail to load. Now add
:8080 to the end of the URL and the index page should now load.
The change we made above was immediately applied to Nginx and did not require us to redeploy our application, but some changes do require that you redeploy you entire application before they are enabled.
More advanced options
Cloud 66 supports a wide range of configuration customizations for Nginx. You can read our in-depth reference guide for more details.
All changes to configuration files in Cloud 66 are automatically tracked and version controlled by CustomConfig git. Read our guide to better understand the power of this feature.
Editing your Nginx configuration should be approached with caution as an incorrect value can break your application on the front-end. We suggest testing all changes in your non-production environments before applying them to a live application.