If you need to integrate Java services within other web application technologies like PHP or NodeJS, NGINX currently might be the best choice for your main HTTP server.
You easily can run a ResoaGateway as a standalone container, listing to 127.0.0.1 for all service calls. As an example, set up a Jetty embedded  Resoa service container:
public JettyEmbeddedContainer() {
Server server = new Server();
ServerConnector http = new ServerConnector(server);
http.setHost("127.0.0.1");
http.setPort(8080); //listen on port 8080
// add the connector
server.addConnector(http);
try {
// create a Jetty servlet handler
ServletHandler handler = new ServletHandler();
server.setHandler(handler);
// set up a LocalContainerServlet, first argument is the gateway root path, second the classpath of your service implementation files
ServletHolder servlet = new ServletHolder(new LocalContainerServlet ("/resoa/resources", "${jetty.base}/lib/ext"));
// listen to all incoming requests
handler.addServletWithMapping(servlet, "/*");
server.start();
server.join();
} catch (Exception e) {
e.printStackTrace();
}
}
Host/Dispatcher configuration of the LocalContainerServlet
The LocalContainerServlet looks for a folder named hosts within the gateway root. Simply put Rest service configuration xml files into this folder. As an example:
<Rest xmlns="http://www.resoa.org/deploy">
<!-- Define the Host domains -->
<Hosts cookieDomain="foo.org" domain="myapp.foo.org"/>
<Hosts cookieDomain="foo.com" domain="myapp.foo.com" />
<!-- Define the URL to service dispatching -->
<Dispatcher>
<!-- Resoa URL to Service package routing. Map the java package name of your service model to an URL -->
<Services path="/service/partner" package="org.foo.partner" />
<Services path="/service/products" package="org.foo.products" />
<Services path="/service/main" package="org.foo.main" />
<Services path="/service/media" package="org.foo.media" />
</Dispatcher>
</Rest>
NGINXÂ configuration example
Example configuration of a virtual server providing access to Resoa services within nginx.conf.
# Virtual Server configuration
server {
listen 80;
server_name foo.org;
root /webroot/foo.org;
# pass Resoa service calls
location /service/ {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
# add further locations, i.e. PHP FastCGI, etc
}
Check the NGINX reverser proxy configuration documentation for more information about.