Stuck @15:48 - Any ideas why I can mysql -u app -p and use the password in my .env file just fine, create the database and everything else, but when I run php artisan migrate --force, I get SQLSTATE[HY000] [1045] Access denied for user 'app'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = bogm and table_name = migrations and table_type = 'BASE TABLE')? I have checked the env DB_DATABASE, DB_USERNAME and DB_PASSWORD more times that I can remember and literally copy and paste to log into mysql, but it doesn't work to migrate... The only thing that ended up working was running sudo cat /etc/mysql/debian.cnf and using the debian-sys-maint credentials in my .env ...
i had the same problem but after 4 hours of debugging and research i found out i had used a password that collided with the .env syntax, i had to wrap it in quotation marks and it worked, example >pass: #iLoveK0ala and in .env DB_PASSWORD=#iLoveK0ala will throw an error as everything after the hashtag is ignored as a comment,
Hi, maybe you need to change the permissions on those files to be accessible by the nginx try sudo chown -R www-data.www-data path/to/your/css do that also for your js
you just do git pull in the server and it should update. If you add more composer packages or migrations you have to run those commands again in the server as well.
You can buy a separate database if you want, but you can also set up a database in the same server without additional cost. The way I did it in this tutorial, it won't generate additional charges
You might have another version of fpm installed, make sure the php-fpm path that you added to the nginx file exists, if it doesn’t change to the one that exist within the same path (probably same name different version number)
@@cosmeescobedo yes! fpm did not exist. I installed it and the website is working finally. Thank you! Now it seems that all styling are not applied, and only homepage loads successfully. All other links give 403 forbidden response. May you help me again, please? 🙈
Is it a Laravel forbidden or an nginx forbidden? If it’s nginx you should be able to see the error in the nginx logs, I don’t remember where the log file is located tho, if it’s Laravel then it’s something to do with your code or you can look at your app’s logs
@@cosmeescobedo when I removed deny all; part in available sites file, everything worked! I am not an expert, so I am worried that removing it is dangerous. Please give me an advice. Thanks a lot for helping
fantastic tutorial! I am getting this error when I tried to set up a password for mysql.. after entering: sudo mysql_secure_installation Failed! Error: SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters any idea how to fix this?
here is what worked: 1. close terminal 2. ssh back again into the server 3. sudo mysql 4. enter this command once you are inside the msql: alter user root@localhost identified with mysql_native_password by 'yourpassword'; 5. enter -> flush privileges; 6. exit 7. and then continue with: sudo mysql_secure_installation
Even though I followed all the steps perfectly, I still get the: refused to connect. Try: Checking the connection Checking the proxy and the firewall ERR_CONNECTION_REFUSED Error
why this error sudo service nginx restart Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
Hey! Thanks for the tutorial, very easy to follow! But I ran into an issue unfortunately. I did every step and everything seemed to work fine (the only thing I didnt do was to make me able to ssh into my new user directly and also the mysql install since I already had it). When I try to reach my site via the ip address now I get the 502 Bad Gateway error and I wonder if you have any clue as to where the issue could originate? It's such a general error message and I'm very new to deployment in general, and first time using Nginx, so any help is appreciated! nginx/error.log shows nothing, and I double-checked that the IP address is correct in the nginx configuration
Hi, sorry about your problem, are you checking the error log in /var/log/nginx/? Also can you check your Laravel logs as well? I doubt that's the issue but maybe you can find more information there, let me know if you're still having issues
your video is great, but in description there is a spelling mistake 'sudo chown -R www-data.www-data boostrap/cache' **bootstrap**, but very helpful video.
Hello Cosme. I am using Digital Ocean Ubuntu 20.04. I had to install PHP 7.2 for my project to work since "composer install" was failing since my current version was a lot newer. Now "php artisan key:generate" fails: myuser@myproject:/var/www/amit$ php artisan key:generate PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in /var/www/amit/vendor/laravel/framework/src/Illuminate/Container/Container.php:873 What do you recommend ? Thank You !!
Get $100 in digital ocean credits: m.do.co/c/71d7fa9ca3d3
wow, so easy as butter, how on earth could anything be that easy I don't understand.
Your tutorial is very help full for me, thank you so much
I don't know why but I received the error 502 Bad Gateway.
Did you fix it?
I found the errror
Check your nginx configuration, fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; This could be version 8.0
you are awesome man. Hitting right to spot
WOW, such a great tutorial!
but man I really need to learn Linux, I had enough.
Quick question, how can i tansfer domain names to this server?
Stuck @15:48 - Any ideas why I can mysql -u app -p and use the password in my .env file just fine, create the database and everything else, but when I run php artisan migrate --force, I get SQLSTATE[HY000] [1045] Access denied for user 'app'@'localhost' (using password: YES) (SQL: select * from information_schema.tables where table_schema = bogm and table_name = migrations and table_type = 'BASE TABLE')? I have checked the env DB_DATABASE, DB_USERNAME and DB_PASSWORD more times that I can remember and literally copy and paste to log into mysql, but it doesn't work to migrate...
The only thing that ended up working was running sudo cat /etc/mysql/debian.cnf and using the debian-sys-maint credentials in my .env ...
Hey, maybe you have old config cache, try running `php artisan config:clear` to clean it, hope it helps.
i had the same problem but after 4 hours of debugging and research i found out i had used a password that collided with the .env syntax, i had to wrap it in quotation marks and it worked, example >pass: #iLoveK0ala and in .env DB_PASSWORD=#iLoveK0ala will throw an error as everything after the hashtag is ignored as a comment,
I successfully deploy it, but it my JS & CSS file are not permitted to load, in my console log it shows me `net::ERR_ABORTED 403 (Forbidden)`
Hi, maybe you need to change the permissions on those files to be accessible by the nginx try sudo chown -R www-data.www-data path/to/your/css do that also for your js
Greate Job & Clean Work, Thanks a lot and good luck
great job, thank you
how would you update it ? would u just do git pull on the linux ?
You can do that, but I wrote an article a couple of years ago where I show how I do it cosme.dev/post/zero-down-deployment-for-laravel-apps
Thanks for the video! When I update my code locally, and then push to Git, how do I update the site with new git commit??
you just do git pull in the server and it should update. If you add more composer packages or migrations you have to run those commands again in the server as well.
Getting 403 forbidden where as i have provided permissions to public and other folderls
Hey, make sure to check the logs under /var/log/nginx/error.log that might point you in the right direction
Please do they charge you seperately for the database there
You can buy a separate database if you want, but you can also set up a database in the same server without additional cost. The way I did it in this tutorial, it won't generate additional charges
@@cosmeescobedo ok sir thank you
Thanks a lot 😍
great job🙏🏽
Do you do some work on the side. I have a problem with Error 500…. I’m looking for someone to do the work.
Hi, sorry, but not right now, hope you find help!
Check your nginx configuration, fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; This could be version 8.0
Thank you! followed the steps and everything is great! but at last, I got: 502 Bad Gateway on the browser. can you help me, please?
You might have another version of fpm installed, make sure the php-fpm path that you added to the nginx file exists, if it doesn’t change to the one that exist within the same path (probably same name different version number)
@@cosmeescobedo yes! fpm did not exist. I installed it and the website is working finally. Thank you!
Now it seems that all styling are not applied, and only homepage loads successfully. All other links give 403 forbidden response. May you help me again, please?
🙈
Is it a Laravel forbidden or an nginx forbidden? If it’s nginx you should be able to see the error in the nginx logs, I don’t remember where the log file is located tho, if it’s Laravel then it’s something to do with your code or you can look at your app’s logs
@@cosmeescobedo when I removed deny all; part in available sites file, everything worked! I am not an expert, so I am worried that removing it is dangerous. Please give me an advice. Thanks a lot for helping
fantastic tutorial! I am getting this error when I tried to set up a password for mysql.. after entering: sudo mysql_secure_installation
Failed! Error: SET PASSWORD has no significance for user 'root'@'localhost' as the authentication method used doesn't store authentication data in the MySQL server. Please consider using ALTER USER instead if you want to change authentication parameters
any idea how to fix this?
here is what worked:
1. close terminal
2. ssh back again into the server
3. sudo mysql
4. enter this command once you are inside the msql:
alter user root@localhost identified with mysql_native_password by 'yourpassword';
5. enter -> flush privileges;
6. exit
7. and then continue with: sudo mysql_secure_installation
@@fabsync Hey sorry for not replying, I'm glad you figured it out, thanks for commenting for the next person 😁
Thanks
Even though I followed all the steps perfectly, I still get the: refused to connect.
Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
Error
Please check the nginx logs in /var/logs/nginx/error.log
ip/login 403 Forbidden
me too, tried different permission granted commands, and didn't work
why this error
sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
Hey! Thanks for the tutorial, very easy to follow! But I ran into an issue unfortunately.
I did every step and everything seemed to work fine (the only thing I didnt do was to make me able to ssh into my new user directly and also the mysql install since I already had it).
When I try to reach my site via the ip address now I get the 502 Bad Gateway error and I wonder if you have any clue as to where the issue could originate? It's such a general error message and I'm very new to deployment in general, and first time using Nginx, so any help is appreciated!
nginx/error.log shows nothing, and I double-checked that the IP address is correct in the nginx configuration
Hi, sorry about your problem, are you checking the error log in /var/log/nginx/? Also can you check your Laravel logs as well? I doubt that's the issue but maybe you can find more information there, let me know if you're still having issues
Did you manage to sort this?
I'm getting a 521 error yet everything seems like it should be okay
@Sandra Danielson did you manage... I found the solution
@@motorsportformula1motorgpr816 hey mate i have the same issue can you help me with it?
in .env you must replace app_debug:true inorder to view the error and not get the generic error of 500 server.
your video is great, but in description there is a spelling mistake 'sudo chown -R www-data.www-data boostrap/cache' **bootstrap**, but very helpful video.
Hello Cosme. I am using Digital Ocean Ubuntu 20.04. I had to install PHP 7.2 for my project to work since "composer install" was failing since my current version was a lot newer. Now "php artisan key:generate" fails: myuser@myproject:/var/www/amit$ php artisan key:generate
PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in /var/www/amit/vendor/laravel/framework/src/Illuminate/Container/Container.php:873
What do you recommend ? Thank You !!
This problem I found solution for Update php8.1