VueJs FrontEnd instance with Laravel BackEnd Api wire with Nginx in Centos

so I have the following server blocks for nginx and I am trying to add … Read more VueJs FrontEnd instance with Laravel BackEnd Api wire with Nginx in Centos

so I have the following server blocks for nginx and I am trying to add a domain to it so I can install it live with google authentication. These servers blocks work with the IP but I am trying to get it to work with the domain. Any thoughts of what I am doing wrong?

VueJs FrontEnd Server block

server {
        listen 3001;
        server_name domain.com;//an example
        keepalive_timeout 60;
        index index.html;

        location / {
                root /var/www/html/app/front/dist;

        }
}

Laravel 8 BackEnd Server Block

server {
    listen       8001;
    server_name  domain.com;//example

    index index.php;
    autoindex on;

    root /var/www/html/app/api/public;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ .php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

If I make a call at domain.com/api, I get a 404 Not Found

Source: Vue – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *