'Wildfly for backend and NGINX for frontend

I am trying to deploy an entire application that is build in ReactJS Frontend and Spring Backend. The backend that is serving APIs is already deployed in the server using WildFly.

My question is can I install NGINX on the same server to host the ReactJS frontend?



Solution 1:[1]

Yes, you can install NGINX and WildFly on the same server.

In such a scenario, typically NGINX is configured as 'reverse proxy'. For example, when your WildFly is listening on port 8080, you make an NGINX configuration like:

server {
    listen 80;
    server_name _;
    index index.html;

    location / {
        root /path/to/var/www/yourSite;
    }

    location /YourAPIRoot/ {
        proxy_pass http://localhost:8080/YourAPIRoot/;
    }
}

See also

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tomoki Sato