I am trying to run nginx on a virtual machine server that i have purchased to run my website that i am creating. I am fairly new to webservers and setting them up in general but i seem to have got the nginx config to at least direct to the proper index file. But for some reason i am getting the error above. I think its because its expecting js and getting html or vice versa. Below is all my code:
Index.html in ./EqualityTee/front-end/public/index.html
<!DOCTYPE html>
<html>
<head>
<title>Trend.com</title>
</head>
<body>
<div id="root"></div>
<script src="./bundle.js"></script>
</body>
</html>
index.js in ./EqualityTee/front-end/src/index.js
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { Auth0Provider } from "./react-auth0-spa.js";
import config from "./utils/auth_config.json";
import history from "./utils/history.js";
// A function that routes the user to the right place
// after login
const onRedirectCallback = appState => {
history.push(
appState && appState.targetUrl
? appState.targetUrl
: window.location.pathname
);
};
ReactDOM.render(
<Auth0Provider
domain={config.domain}
client_id={config.clientId}
redirect_uri={window.location.origin}
onRedirectCallback={onRedirectCallback}
>
<App />
</Auth0Provider>,
document.getElementById("root")
);
nginx config file
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /var/www/EqualityTee;
# Add index.php to the list if you are using PHP
index /front-end/public/index.html;
server_name equalityfits.com www.equalityfits.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri /front-end/public/index.html$is_args$args;
}
location ~ .(static)/(js|css|media)/(.+)$ {
try_files $uri $uri/ /$1/$2/$3;
}
Access Log
38.103.205.179 - - [24/Jun/2020:17:25:39 +0000] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.106 Safari/537.36"
No errors in error log
When i run a local server using my website the bundle.js is pointed at the location https://localhost:8080/bundle.js so i think i have it pointing to the right location, but what am i missing here?