Set up nginx webserver for OpenEMS UI
This chapter explains how to set up the nginx webserver for OpenEMS UI.
1. Quick setup under Linux
| These instructions are intended for a quick setup, e.g. to get started with OpenEMS UI. Instructions for a production deployment may be added in the future. |
1.1. Setup
We assume that the files for OpemEMS UI are in /home/user/openems/openems-ui
-
Install nginx (e.g.
apt install nginxon Debian / Ubuntu and derivatives) -
Create a file /etc/nginx/conf.d/openems_nginx.conf with the following contents:
server { listen 4200; server_name openems; # OpenEMS Web-Interface location / { root /home/user/openems/openems-ui; index index.html index.htm; error_page 404 300 /index.html; } } -
Start nginx. See
man nginxand the documentation on https://nginx.org for more information.
OpenEMS UI should now be available on port 4200.
1.2. Troubleshooting
-
If there are error messages saying that port 80 is already used, e.g. by another webserver already running on your machine: Remove /etc/nginx/sites-enabled/default. This is a link to /etc/nginx/sites-available/default where port 80 is configured to be used.
-
If the browser shows “403 forbidden”, this may be due to missing permissions. nginx needs read and execute permissions on all directories on the path to the openems-ui directory. You can check this with the command
namei -l /home/user/openems/openems-ui. For example, /home/user might have “rwx” permissions only for user. In that case, the commandchmod a+rx /home/userchanges the permissions, so that nginx can run openems-ui.