Step 1. Install Nginx. Below in the example, at first we are updating the local package index so that we can access to the most recent package listings. Afterwards, we are installing Nginx and any required dependencies on the server.

$ sudo apt-get update
$ sudo apt-get install nginx

Step 2. Adjust the Firewall. Allow the traffic on port 80 using Nginx HTTP. Depending on your requirements, you can also open port 443 specifying Nginx HTTPS instead (TLS/SSL encrypted traffic).

$sudo ufw allow 'Nginx HTTP'

Step 3. Check status of Nginx.

$ systemctl status nginx

Step 4. Create and customize per-site "server blocks". On this step we need to create the spellcheck configuration file in the /etc/nginx/sites-available/ directory which will be later link to the sites-enabled directory.

$ sudo cd /etc/nginx/sites-available/
$ sudo cp default spellcheck
$ sudo nano spellcheck

Here is an example of spellcheck configuration file for Nginx.

spellcheck
# 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 _;

	location /spellcheck/ {
            alias /opt/WSC/WebComponents/WebInterface/;
            autoindex on;
            index  index.html index.htm;
            
			location /spellcheck/samples/ {
                    alias /opt/WSC/WebComponents/Samples/;
                    autoindex on;
                    index  index.html index.htm;
            		}
			location /spellcheck/wscbundle/ {
                    alias /opt/WSC/WebComponents/WebInterface/wscbundle/;
                    autoindex on;
            		}
			}	
	}

Step 5. Create symlink for the 'spellcheck' configuration file. Now we are linking the spellcheck configuration file from /etc/nginx/sites-available/ directory with /etc/nginx/sites-enabled/.

$ ln -s /etc/nginx/sites-available/spellcheck /etc/nginx/sites-enabled/spellcheck

Step 6. Restart Nginx. To apply changes it is recommended to restart Nginx.

$ sudo systemctl restart nginx

  • No labels