5.2.2. Setting up an Nginx front-end

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

Basic configuration for Nginx

Note

You can find the detailled documentation on the nginx configuration as reverse proxy here

Nginx supports reverse-proxy instructions without the need to add modules.

This is an example of a nginx server configuration acting as a reverse proxy of a eXo Platform back-end :

server {
  listen 80 default_server;
  server_name my.server.name;

  # TODO Adapt this value to your needs
  client_max_body_size 250m;  

  location / {
    proxy_pass http://127.0.0.1:8080;
    # Pass the client informations the the backend
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
  # Websocket for notifications
  location /cometd/cometd {
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }

  access_log   /my/path/my.server.name-access.log log_with_durations;
  error_log    /my/path/my.server.name-error.log;

}

Note

We are assuming the eXo Platform server is reachable at the ip 127.0.0.1 on port 8080. You have to adapt the configuration according to your installation.

This example uses a log definition called log_with_durations. This is a customization of the default combined log format with the request durations. It's totaly optional, if you don't want to override the log configuration, use the combined format You can add it to your nginx configuration by adding the following line in your host section :

log_format combined_duration '$remote_addr - $remote_user [$time_local] '
                  '"$request" $status $body_bytes_sent '
                  '"$http_referer" "$http_user_agent" $request_time';
        

It's also good to add this option to limit the server exposition:

server_tokens off;

Note

It is also recommanded to enable the apache status page to be able to monitor the apache behavior. More info are available here

See also

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus