Step 1. Install NGINX.

sudo apt-get update
sudo apt-get  install nginx

Step 2. Customize the firewall.

sudo ufw allow  'Nginx Full'

Step 3. Check the status of NGINX web server.

systemctl status nginx

Step 4. Create and customize 'server blocks'.

sudo cd /etc/nginx/sites-available/
sudo cp default wscservice
sudo nano wscservice

Here is an example of wscservice configuration file for NGINX.

wscservice
# Default server configuration
#
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

	server_name wscservice;

	# bindings of static files
	location /wscservice/ {
		alias /opt/WSC/WebComponents/WebInterface/;
		autoindex on;
		index  index.html index.htm;

	location /wscservice/samples/ {
		alias /opt/WSC/WebComponents/Samples/;
		autoindex on;
		index  index.html index.htm;
		}
			
	location /wscservice/wscbundle/ {
		alias /opt/WSC/WebComponents/WebInterface/wscbundle/;
		autoindex on;
		add_header Access-Control-Allow-Origin '*';
		}

	# reverse proxy for proxying requests to AppServer
	location /wscservice/api {
    # location /wscservice/api/ with a slash for WebSpellChecker versions 5.15.0.0 only
    proxy_pass http://your_host:2880;
		}    

	}	
}

Step 5. Create symlink for the 'wscservice' file.

ln -s  /etc/nginx/sites-available/wscservice /etc/nginx/sites-enabled/wscservice

Step 6. Restart NGINX.

sudo systemctl restart nginx

Step 7. NGINX troubleshooting if the restart fails. Probably the default NGINX config already uses the 80/443 port or you added an extra curly brace.

sudo nginx -t



  • No labels