Serving Laravel from a directory

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


Serving Laravel from a directory



I am currently using a javascript framework being served up using Nginx, for example on the following url


www.myjsapp.com



I am also using Laravel 5.6 to build an API.



Instead of building 2 hosts, one for the JS app and one for Laravel, I want to be able to serve up the Laravel API on the following URL.


www.jsapp.com/api



Is this possible or do I have to always use 2 hosts?




1 Answer
1



You can separate the servers using location blocks in your nginx config file:
different /location blocks will capture different url schemes and execute them to respective servers (node or laravel).


location


/location


server {
server_name mysjapp.com;

#other configurations like root, logs

location / {
#node server config

}

location /api {
#laravel server config
}
}






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

C# - How to create a semi transparent or blurred backcolor on windows form

Will Oldham

Makefile test if variable is not empty