I'm settings two projects in the same domain, a first project is a ReactJS project for my front end and a second project for my API in symfony.
I need config the virtual host of nginx so that my domain www.example.com go to my reactjs roject and www.example.com/api go to my symfony project.
The others router example www.example.com/register or www.example.com/login must be go to reactjs project and the sub folder in www.example.com/api/* go to my symfonys project.
I use Ubuntu 16.04. I've tried te next config
server {
listen 80;
server_name example.com www.example.com;
location /api {
root /var/www/symfony/public;
try_files $uri /index.php$is_args$args;
}
location / {
root /var/www/reactjs/build;
index index.html index.htm index.nginx-debian.html;
try_files $uri /index.html;
}
location ~* \.(eot|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
error_log /var/log/nginx/Inno_FRT__error.log;
access_log /var/log/nginx/Inno_FRT__access.log;
}
But this not work.
I have tried many different variations of the above without success.
Any assistance would be greatly appreciated.