nginx

We will be converting to nginx for most if not all web and proxy related tasks over time. The purpose of this page is to document topics related to nginx.

References:

Reverse Proxy Configuration

This section is a place holder until the installation script is updated to use nginx instead of apache. Here is a typical configuration for nginx to replace apache for iDempiere

server {
    listen 80;
    server_name idempiere_http;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    server_name idempiere_https;

    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
    ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

    location / {
        proxy_pass https://0.0.0.0:8443/;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Host $host;
        proxy_ssl_verify off;
        proxy_ssl_server_name on;
        proxy_connect_timeout 5400s;
        proxy_read_timeout 5400s;
        proxy_send_timeout 5400s;
    }

    error_log /var/log/nginx/error.log;
    access_log /var/log/nginx/access.log combined;
}

Changing from Apache

Here are reference steps to help you move away from Apache

  1. Install nginx
    1. sudo apt install nginx
  2. Add the above configuration to /etc/nginx/sites-available/ as say, "nginx-idempiere.conf”
  3. symlink in /etc/nginx/sites-enabled:
    1. sudo ln -s /etc/nginx/sites-available/nginx-idempiere.conf default
  4. Stop Apache
    1. sudo service apache2 stop
  5. Reuse Apache SSL certs
    1. This step depends how you obtained your certs
  6. Start nginx (if not already started)
    1. sudo service nginx start
  7. Remove apache from startup scripts
    1. sudo update-rc.d apache remove
    2. sudo update-rc.d apache-htcacheclean remove
  8. Add nginx (should already have been added by install process)
    1. sudo update-rc.d nginx enable