Inigo EC
Inigo EC

Reputation: 2328

Laravel API calls failing in Production

I'm currently working on a VueJS+Laravel 6 project.

Everything is working ok in Localhost, but in Production, although the web routes work well, the API calls fail.

I have no errors in the Apache log and Laravel log.

Am I missing anything that I should update related to Laravel passport?

I simly run php artisan passport:install in production.

This is what I install in the Ubuntu server

apt-get install zip unzip fail2ban python php7.4-common php7.4-cli php7.4-gd php7.4-mysql php7.4-curl php7.4-intl php7.4-mbstring php7.4-bcmath php7.4-imap php7.4-xml php7.4-zip apache2 libapache2-mod-php mysql-server ffmpeg cron npm nodejs

I tried not to install fail2ban, but it didn't help.

This is my virtualhost

    <VirtualHost *:80 *:443>

            ServerAdmin webmaster@localhost
            DocumentRoot /var/www/myproject/public

            <Directory />
                    Options FollowSymLinks
                    AllowOverride None
            </Directory>
            <Directory /var/www/myproject>
                    AllowOverride All
            </Directory>

            ErrorLog ${APACHE_LOG_DIR}/error.log
            CustomLog ${APACHE_LOG_DIR}/access.log combined

    </VirtualHost>

I set up the following rights:

chown -R www-data.www-data ./ && chmod -R 755 ./ && chmod -R 777 storage && chmod -R 777 bootstrap/cache/

And these are the artisan commands I run

php artisan key:generate && php artisan migrate:fresh --seed && php artisan storage:link && php artisan passport:install && php artisan config:cache

Upvotes: 0

Views: 135

Answers (1)

Inigo EC
Inigo EC

Reputation: 2328

Well... I was apparently missing to run sudo a2enmod rewrite

Leaving it here for a case it helps someone else in the future

Upvotes: 1

Related Questions