Create a new distribution in CloudFront. Select distribution method "Web".
Fill in your domain name in the"Origin Domain Name" field and set "Origin Protocol Policy" as "Match Viewer". Then create the distribution.
After the distribution is created, it will provide you with a cloudfront.net domain name. This will be your CDN domain name. The distribution will take about 20-30 minutes before it is fully setup.
Next, you will need to enable asset_host config in your rails environment.
config.action_controller.asset_host = 'https://dxxxxxxxxxxxx.cloudfront.net'
Finally, reboot your Nginx server when the distribution status is in "Deployed" state.