Summer Sale! All accounts are 50% off this week.

maxshy1337's avatar

NGINX with only API Laravel

Hello everyone. Whats the proper way to configure nginx with laravel api. all my routes located in routes/api.php and they are all apiResouces; But now i'm getting 404 with html while making any http req.

upstream api {
    server 194.xx.xx.xx;
}

server {
        listen 81 default_server;
        listen [::]:81 default_server;
        error_log  /var/log/nginx/backend-error.log error;
        access_log /var/log/nginx/backend.log;
        server_name api.mysite.com;
        location / {
            proxy_pass         http://api;
        }
}

.env

APP_URL=http://api.mysite.com/
nginx/1.14.0 (Ubuntu)

P.s frontend on the same server works fine (another var/www/ folder and nginx config)

0 likes
1 reply

Please or to participate in this conversation.