Deployment Configurations of Front end Application to Nginx on Debian - AyranIsTheNewRaki/Herodot GitHub Wiki

I had the issue of orphaned annotations after embedding Hypothesis client to our Front-end application. I assumed this was due to the domain name localhost. Instead of simply editing the hosts file to redirect requests from example.com to localhost:3000 I used nginx server.

  1. Build the app
npm run build
  1. Locate your default server path. Copy source directory contents and node_modules into the server path
sudo su
cd /var/www/html
cp -R $Herodot/Frontend/src .
cp -R $Herodot/Frontend/node_modules .
  1. Edit nginx configurations to let the server route table know that if it can't find a file, path, it should direct the request to index.html. Contents of the file will be like the following:
server {
	listen 80 default_server;
	listen [::]:80 default_server;

	root /var/www/html;

	index index.html;

	server_name _;

	location / {
		try_files $uri $uri/ /index.html =404;
	}


}
  1. Edit /etc/hosts to redirect example.com to localhost:
127.0.0.1	localhost
127.0.0.1       example.com

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters