I am trying to install a react.js app and using pm2
package for running the server.
My /etc/nginx/sites-available/default
file's contents are:
server {
listen 80;
server_name my.domain.name;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
My react server is running on port 8080, since when I do curl localhost:8080
from the server, I get the appropriate response. Also, with curl localhost
also I get the correct react server's response.
However, when I visit my.domain.name
in the browser, I just get the default nginx page saying it's successfully installed.
What am I missing here?
Edit:
Added Reactjs app's server.js
file:
var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('./webpack.config');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
hot: true,
historyApiFallback: true
}).listen(8080, 'localhost', function (err, result) {
if (err) {
return console.log(err);
}
console.log('Listening at http://localhost:8080/'); });