How to Configure PHP for Nginx with PHP-FPM on Ubuntu
HTML-код
- Опубликовано: 23 авг 2024
- Learn how to configure Nginx to use a specific version of PHP and PHP-FPM on Ubuntu.
Find more at tonyteaches.tech
Check out my vlog channel @TonyFlorida
#nginx #php #phpfpm
wow got my head around loads of stuff here I've never understood.... plus you sorted my actual problem I was fighting with :-D
Makes me happy to hear that!
OMG THANK YOU SOOO MUCH THIS VIDEO HELPED MORE THAN YOU"LL EVER KNOW KEEP DOING YOUR THING
Makes me very happy to hear that :)
Now watch capslock tutorial.
Your the best teacher for me
Happy to hear that!
Thanks for this... I learned how to change/add ports and with same ip and run different site.
Great video, Tony, thanks for sharing
Thank you! It`s very simple for understanding and useful tutorial
You're welcome
Hey TTT,
would you mind to explain why you are not using "proxy pass" instead of fastcgi_pass? Is there any difference between those two?
im trying to use nginx container as a reverse proxy that sends all php request to wordpress container with php-fpm (they are in the same network)
If you may or not - thanks!
And good video!
Thanks man, I was trying to get that working for like days
Glad I could help
This video is so helpful solving my problem. Thanks.
You're welcome!
Ok thanks for vid that was easy but right now i have a problem with prestashop and import products... when im importing from csv file i have an error after 25 products was imported file have 80-100 products can you lead me to the configuration were can i fix it?
If anybody else still had errors like me, you can probably fix it by putting this line on the top of the file, not inside any of the namespaces (not sure what the http, server, events things are called):
user www-data www-data;
this executes all the nginx operations and stuff with the permissions of www-data which is the user used for web developement usually.
if you have set your user/group to something else change it accordingly in the user directive in your nginx config file
its not best practice to set it as your own user as it might mess things up and even if you get it up and running--if you're not careful youre personal files such as the ones from Downloads/ can be accessed
you really helped me with this.....thanks a lot
Keep seeing: server_name _; What does that mean? Does the underscore do something? Is it here to remind you to set it?
Thanks you I’ll add this video to bookmarks. Thanks for your work. You are the best! 💪🏻💪🏻💪🏻
Excellent, you're welcome!
For PHP 8.1 use add the following lines instead in the nginx config:
location ~ \.php$ {
fastcgi_pass unix:/run/php/php8.1-fpm.sock; # Replace with the correct PHP version and socket path
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
Would like to see HAProxy node + TLS terminantion Nginx (web server only mode) node PHP-FPM node configuration. + passing headers down to the PHP-FPM. With "node" i mean separate servers and not the processes on the same server.
Do you have any documentation/tutorials about this set up?
@@TonyTeachesTech I don't think you will find any complete documentation for such setup. It's rather 3 separate docs.
@@Oswee Understood
Thankyou so much
Most welcome 😊
Thank you so much again, great video, first i was deploying Django, now i'm on php, would you recomend deploy a server in apache2 or nginx?.
I can't connect to the DB through php installed with nginx on my website. Records are not displayed. I also installed php-fpm. Thankx
Thank you, Tony, very helpful. If possible can you also o a tutorial on creating a server on GCP for hosting and managing multiple websites with maybe an FTP software or any website management software.
A video for hosting a node website on GCP Virtual Machine.
thank you.
Hi, I do have a video about multiple website on Nginx ruclips.net/video/P7W4iYkFaOU/видео.html and another on GCP ruclips.net/video/f56PG7QxjFI/видео.html
Both of these use SSH to interact with the websites (my preference), but I can definitely make a video about FTP in the future
Hey , is any way to log php errors to a local file with nginx? , I can't see any php log when an error happens
This dude is good
Thanks :)
thanks got it
You're welcome!
now i need the SSL, i dont know where to put the directives
thanks
No problem
Works ty ty
You're welcome!
Thanks !!!
You're welcome!
thank you
Welcome!
Could you please check nginx 1.20.1 and php8.0-fpm ? i try to install it , but it des not work
Why not?
which font do you use in your terminal?
Just the default. Looks like it's called SF Mono Regular 11
I used Fira Mono and Jetbrains Mono. Yours looks good as well.
How to run multiple project in nginx serve
This video will show you how to do that ruclips.net/video/P7W4iYkFaOU/видео.html
How Nginx remove .php extention
I don’t know which step have error when I curl IP address got my original code 😕
I have forget change the default name to index.php 😭
Happy you figured it out
@@hohojimmy4443 We have all been there. :-)
i did the same as you did but the index.php is a blank page !
Hmm, I don't know why that would happen
after install nginx i have this error This site can’t be reached so i cant open my website
Check your nginx log for clues as to why at /var/log
@@TonyTeachesTech was problem with firewall in terminal i wrote 4 commands for input and output of port 80 and 443 to allow and all fixed
403 Error...
Double check that the path in your Nginx config file to your PHP actually exists. You might have a different version of PHP installed
@@TonyTeachesTech I fixed it. I put an extra space and it didn't work. Thanks!
Неплохо
Thanks
BC you broke my system
Uh oh :(
I love how every php-fpm and nginx post and video just tells u to copy paste shit without 0 explanations. Getting so fucking frustrated with this setup and the lack of knowledge.
You seem like a nice guy and I like your calm way of delivering. But I find it sad, that even someone like you goes the "just for demo I do all as root"-route. That is one of the root causes for a lot of IT un-professionals working as IT-professionals do a lot of insecure crap.
I keep getting this error:
"bash: php8.0-fpm: command not found"
I am able to start php8.0-fpm service, but I don't get any detailed output, and php-fpm wont seem to start running on port 9000.
I'm having a really difficult time figuring out what's happening.
root@ebe9bfc1d0cf:/var/www/html# service php8.0-fpm status
* php-fpm8.0 is running
root@ebe9bfc1d0cf:/var/www/html# ps -waux | grep php
root 627 0.0 0.2 247692 12352 ? Ss 20:21 0:00 php-fpm: master process (/etc/php/8.0/fpm/php-fpm.conf)
www-data 628 0.0 0.2 248000 17132 ? S 20:21 0:00 php-fpm: pool www
www-data 629 0.0 0.2 248000 17132 ? S 20:21 0:00 php-fpm: pool www
root 667 0.0 0.0 3468 1640 pts/1 S+ 20:25 0:00 grep --color=auto php
root@ebe9bfc1d0cf:/var/www/html# netstat -an | grep :9000
root@ebe9bfc1d0cf:/var/www/html#