Install Magento 2 with Nginx on Laravel Forge

Karolis Ščerbiakas • February 2, 2020

magento

Here's how to do it.

composer create-project --repository-url=https://repo.magento.com/magento/project-community-edition .
find . -type d -exec chmod 700 {} \; && find . -type f -exec chmod 600 {}\;

Now if you hit your domain url. If you're unlucky you won't see an installation wizard. Inspect page and go to console tab, and you'll see like side menu panel not found etc.

Laravel Forge nginx config located in

/etc/nginx/sites-available/domain.conf

and you should include magento nginx sample in server block config.

include /home/forge/#YOURDOMAIN#/nginx.conf.sample;

Now that fix that worked for me is: you should and edit php.ini file which is in

/etc/php/7.1/fpm/php.ini

and set

cgi.fix_pathinfo=0

to

cgi.fix_pathinfo=1

Now run

sudo service php7.1-fpm restart

also don't forget to restart nginx

sudo service nginx restart

Now hit your magento installation domain url and you should see an install wizard.

Good luck!

Also! If you are migrating from one server to other and exporting database.
While importing, you might encounter problems where the error is thrown about the column update_at.
It is because of MySQL strict mode is on. So you need to turn it off. Edit

/etc/mysql/mysql.conf.d/mysqld.cnf

Under

[mysqld]

add

sql_mode = '';

don't forget to restart mysql

service mysql restart

Now you should import your database without any problems. After database imported I suggest to turn strict mode back on.