React App on S3, domain on Linode

Hi guys,

I am pretty new to DevOps, my Django app has been successfully running. I have uploaded my React app on S3, I want to use www. as the subdomain for my React app, I have set up pointed my react apps to www on S3, however, it still shows the welcome to Nginx page which I am sure is from the server of the domain, what should i do about it? Do I need to do anything with sites-enables?
thank you for your time

1 Reply

This is a really cool setup you're exploring. I'd be happy to offer my comments on the situation.

First of all, I do want to note that you are welcome to use Linode's DNS Manager to resolve your domains to non-Linode services, but you will need at least one active Linode service on your account in order for our name servers to return records for these domains.

Having mentioned this, I want to explore your issues regarding Nginx. I admit to some confusion over your setup: S3 does enable you to host static sites without the need to run a web server, and while Nginx is most famously a web server, it can also act as a reverse proxy for other applications, including an S3 static web site. I would like to make mention that we at Linode also offer S3-compatible Object Storage which may achieve better throughput if you are using it in the same data center as any of your Linode which may be running Nginx.

Even without being entirely clear on how these components connect to each other, I'm still eager to provide my assistance with the Nginx-related part of this setup. You may want to look at these resources from our Documentation for more information about configuring and working with Nginx to fit your needs:

Every distribution packages Nginx in a different fashion, but the sites-available and sites-enabled convention appears on Debian and its derivatives such as Ubuntu. However you may be using Nginx in your setup, the general procedure for defining your Nginx configuration is to create a configuration file in the directory /etc/nginx/sites-available, then to create what is called a symlink to this file in the directory /etc/nginx/sites-enabled/, which you can achieve using ln -s:

sudo ln -s /etc/nginx/sites-available/your-nginx-config.conf /etc/nginx/sites-enabled/your-nginx-config.conf

This behavior results from the primary Nginx configuration file /etc/nginx/nginx.conf pulling in all of the files it finds in the /etc/nginx/sites-enabled/ directory into its own configuration. It is best to leave the contents of /etc/nginx/nginx.conf alone, instead creating configuration files for your site(s) in the sites-available directory, then enabling them by creating symlinks to these files in the sites-enabled directory.

The configuration files created this way should not be complete configuration files since they will ultimately become incorporated by /etc/nginx/nginx.conf to form a complete Nginx configuration. As such, you may want to use the /etc/nginx/sites-available/default configuration file, which defines the standard Nginx installation webpage you are seeing, as a template for your own configuration.

Once you have a workable configuration that suits your needs, you should see whether there is a symlink to the /etc/nginx/sites-available/default configuration in /etc/nginx/sites-enabled/ directory:

$ ls -la /etc/nginx/sites-enabled
total 8
drwxr-xr-x 2 root root 4096 Feb 19 03:22 .
drwxr-xr-x 8 root root 4096 Nov 14 11:32 ..
lrwxrwxrwx 1 root root   34 Feb 19 03:21 default -> /etc/nginx/sites-available/default
lrwxrwxrwx 1 root root   49 Feb 19 03:22 your-nginx-config.conf -> /etc/nginx/sites-available/your-nginx-config.conf

If so, you may delete it so that it does not interfere with your configuration's actual needs:

$ sudo rm /etc/nginx/sites-enabled/default
$ ls -la /etc/nginx/sites-enabled
total 8
drwxr-xr-x 2 root root 4096 Feb 19 03:24 .
drwxr-xr-x 8 root root 4096 Nov 14 11:32 ..
lrwxrwxrwx 1 root root   49 Feb 19 03:22 your-nginx-config.conf -> /etc/nginx/sites-available/your-nginx-config.conf

As you as working on your configuration file, you may test it out by running this command to determine whether there are any errors:

sudo nginx -c /etc/nginx/nginx.conf -t

It's important to test against /etc/nginx/nginx.conf to test your configuration instead of directly against /etc/nginx/sites-enabled/your-nginx-config.conf. Since this configuration file is not a complete configuration, testing against this file directly will return false configuration errors, but as long as you have a symlink defined in /etc/nginx/sites-enabled/ for your Nginx configuration file, /etc/nginx/nginx.conf will pull in this file and have its contents tested with the above command.

Once you are happy with your configuration and it tests out fine, you may then start using it by restarting your Nginx server with this command:

sudo systemctl restart nginx

We're excited to hear about the progress you're making with your project, and I hope that you find this information valuable as you are working to set it up to your specifications!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct