Score:0

serve nodejs and laravel on same config file

cn flag

i have node and laravel app both serves html file, and the url works like:

myapp-laravel.com -> laravel app

myapp-laravel.com/node/ -> nodejs app

the laravel app works fine, but nodejs can't serve the html and it gives me error "cannot get /node/ file" as plaintext.It works if i separate the config but i want to access it with my main domain (myapp-laravel.com) so i have to put it on same config

upstream node {
    server localhost:3201;
}

server {
    root /var/www/html/laravel-app;
    index index.php index.html
    server_name myapp-laravel.com
   
    location / {
        try_files $uri $uri/ /index.php$args;
    }

    location /node/ {
        alias /var/www/html/node;
        try_files $uri @node;
    }
    
    location @node {
        proxy_pass http://node;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }

}
us flag
Could you please clarify a by examples that show URL and where exactly that URL would fetch its content. It is unclear from your question what exact request isn't working like you want.
bren avatar
cn flag
okay i will update the question
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.