cancel

Installing and Setting Up an Nginx Server on the EB-336x with Linux Debian 9

December 01, 2021

Nginx is an open-source HTTP/HTTPS web server that can also be used as a proxy server. Compatible with HTTP, HTTPS and other protocols of the reverse proxy server, you can now use Nginx instead of the traditional Apache HTTP2 server.

eb336xWeb_img6

This section shows how to install and set up the Nginx web server on the EB-3362 with Linux Debian 9.

Prepare

  • EB-3362
  • SD Card (Built-in Debian9)
  • Screen Monitor
  • Keyboard
  • Ethernet
eb336xWeb_img1
eb336xWeb_img2

Build Nginx Web Server on EB-3362

Step 1: Install Nginx Server

  • Type the following apt-get command/apt command to update your system:
    $ sudo apt update
    $ sudo apt upgrade
  • To install Nginx server, type:
    $ sudo apt install nginx
  • By default, the Nginx server started will start on Debian 9 and it can be verified with the netstat command/ss command and ps command as follows:
    $ ps aux | grep nginx
    $ pgrep nginx
  • Use the netstat command as follows to verify that port 80 is open:
    $ netstat -tulpn | grep :80
eb336xWeb_img3

Step 2: Test the Nginx Server

  • Open up a web browser and type url:
    http://your-domain/
  • Or find your public IP address using the ip command/ifconfig command:
    $ ip a
  • OR
    $ ifconfig eth0
eb336xWeb_img4

Step 3: Configure Nginx Server

In Nginx, all HTML, CSS and Image files are stored by default in the /var/www/html directory, known as the web server's root.
The default directory can be modified in the /etc/nginx/sites-enabled/default config file. You can edit it with either vim command or nano command.

  • Type the following vim command/nano command to setting the web server default file.
    $ sudo vi /etc/nginx/sites-enabled/default
    OR
    $ sudo nano /etc/nginx/sites-enabled/default
    The /etc/nginx/nginx.conf is your main nginx config file and /etc/nginx/sites-enabled/default is the default config file.
  • To create a Virtual Host named “icopdemo”, type:
    $ sudo nano /etc/nginx/sites-available/icopdemo
  • And input the code below in “icopdemo”:
    server {
        listen 80;
        listen [::]:80;
     
        server_name icopdemo;
     
        root /home/icop/www;
        index index.html;
     
        location / {
            try_files $uri $uri/ =404;
        }
    }
  • Let the file synchronize with “icopdemo” and remove the default file.
    • Synchronize:
      $ sudo ln -s /etc/nginx/sites-available/icopdemo /etc/nginx/sites-enabled/
    • Remove the default file:
      $ sudo rm /etc/nginx/sites-enabled/default
  • Establish the path for the web page location and create the webpage.
    $ sudo mkdir ~/www
    $ sudo nano ~/www/index.html
  • Type the following website code to the index.html:
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to Icop Tech</title>
    <style>
        body {
            width: 35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to ICOP Tech</h1>
    <p>This is a test for Nginx web server.</p>
     
    <p><em>Hello world.</em></p>
    </body>
    </html>
  • Save and close the file.
    Reload the Nginx server to start the new web server.
    $ sudo systemctl reload nginx
eb336xWeb_img5

Enter the IP address to display the web page (~/www/index.html) from the Nginx web server.
You can replace ~/www/index.html with the web page you want to display.


Main features of EB-3362-L2C2851G1E-I:

  • DM&P SoC Vortex86DX3- 1GHz
  • 1GB / 2GB DDR3 onboard
  • 3S / 3U / VGA / GLAN / LAN / Audio / 8GPIO / SATA / 8~24V
  • Operation Temperature: -20 ~ +70°C
  • Auto Power On
  • VESA Mount

For more info and sample request, please write to info@icop.com.tw, call your nearest ICOP Branch, or contact our Worldwide Official Distributor.

Δ