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

Комментарии • 74

  • @GrahamRimmington
    @GrahamRimmington 2 года назад +1

    wow got my head around loads of stuff here I've never understood.... plus you sorted my actual problem I was fighting with :-D

  • @The_Oddity
    @The_Oddity 2 года назад +1

    OMG THANK YOU SOOO MUCH THIS VIDEO HELPED MORE THAN YOU"LL EVER KNOW KEEP DOING YOUR THING

  • @tunlinaung010
    @tunlinaung010 3 года назад

    Your the best teacher for me

  • @hisatnam
    @hisatnam 2 года назад

    Thanks for this... I learned how to change/add ports and with same ip and run different site.

  • @EddieMao
    @EddieMao 7 месяцев назад

    Great video, Tony, thanks for sharing

  • @yaolegoleynik
    @yaolegoleynik 3 года назад +1

    Thank you! It`s very simple for understanding and useful tutorial

  • @tonykososki3016
    @tonykososki3016 2 года назад +2

    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!

  • @emretasdemir8028
    @emretasdemir8028 Год назад

    Thanks man, I was trying to get that working for like days

  • @kfchenghk
    @kfchenghk 2 года назад

    This video is so helpful solving my problem. Thanks.

  • @crossfire423
    @crossfire423 2 месяца назад

    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?

  • @mitaka_78
    @mitaka_78 Год назад

    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

  • @acuteclub7381
    @acuteclub7381 10 месяцев назад

    you really helped me with this.....thanks a lot

  • @tubejim101
    @tubejim101 Год назад

    Keep seeing: server_name _; What does that mean? Does the underscore do something? Is it here to remind you to set it?

  • @denysbarzynskyi2494
    @denysbarzynskyi2494 3 года назад

    Thanks you I’ll add this video to bookmarks. Thanks for your work. You are the best! 💪🏻💪🏻💪🏻

  • @Minhazmohamed
    @Minhazmohamed Год назад +1

    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;
    }

  • @Oswee
    @Oswee 3 года назад

    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.

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Do you have any documentation/tutorials about this set up?

    • @Oswee
      @Oswee 3 года назад

      @@TonyTeachesTech I don't think you will find any complete documentation for such setup. It's rather 3 separate docs.

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      @@Oswee Understood

  • @unnip9802
    @unnip9802 7 месяцев назад

    Thankyou so much

  • @andresdemillos01
    @andresdemillos01 Год назад

    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?.

  • @BlueTeamBorja
    @BlueTeamBorja 2 года назад

    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

  • @PlayhouseMediaGroup
    @PlayhouseMediaGroup 3 года назад

    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.

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      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

  • @martial5483
    @martial5483 Год назад

    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

  • @diegoslinger1254
    @diegoslinger1254 2 года назад

    This dude is good

  • @JkeyKong
    @JkeyKong Год назад

    thanks got it

  • @LegendaryVenom
    @LegendaryVenom 9 месяцев назад

    now i need the SSL, i dont know where to put the directives

  • @-themixchannel2290
    @-themixchannel2290 Год назад

    thanks

  • @inspirer4465
    @inspirer4465 2 года назад

    Works ty ty

  • @CiroPeixoto
    @CiroPeixoto Год назад

    Thanks !!!

  • @MasterPimp94v1
    @MasterPimp94v1 2 года назад

    thank you

  • @bluefire8888
    @bluefire8888 3 года назад

    Could you please check nginx 1.20.1 and php8.0-fpm ? i try to install it , but it des not work

  • @sirajul-anik
    @sirajul-anik 3 года назад

    which font do you use in your terminal?

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад +1

      Just the default. Looks like it's called SF Mono Regular 11

    • @sirajul-anik
      @sirajul-anik 3 года назад

      I used Fira Mono and Jetbrains Mono. Yours looks good as well.

  • @shuhampcpl6286
    @shuhampcpl6286 2 года назад

    How to run multiple project in nginx serve

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад

      This video will show you how to do that ruclips.net/video/P7W4iYkFaOU/видео.html

  • @jogeshchandrabaidya1896
    @jogeshchandrabaidya1896 7 месяцев назад

    How Nginx remove .php extention

  • @hohojimmy4443
    @hohojimmy4443 3 года назад

    I don’t know which step have error when I curl IP address got my original code 😕

    • @hohojimmy4443
      @hohojimmy4443 3 года назад

      I have forget change the default name to index.php 😭

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Happy you figured it out

    • @gorillaau
      @gorillaau 2 года назад

      @@hohojimmy4443 We have all been there. :-)

  • @gogogogogogogogogogog9
    @gogogogogogogogogogog9 3 года назад

    i did the same as you did but the index.php is a blank page !

  • @PikBo100
    @PikBo100 2 года назад

    after install nginx i have this error This site can’t be reached so i cant open my website

    • @TonyTeachesTech
      @TonyTeachesTech  2 года назад

      Check your nginx log for clues as to why at /var/log

    • @PikBo100
      @PikBo100 2 года назад

      @@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

  • @Nobody-df7vn
    @Nobody-df7vn 3 года назад +1

    403 Error...

    • @TonyTeachesTech
      @TonyTeachesTech  3 года назад

      Double check that the path in your Nginx config file to your PHP actually exists. You might have a different version of PHP installed

    • @Nobody-df7vn
      @Nobody-df7vn 3 года назад +1

      @@TonyTeachesTech I fixed it. I put an extra space and it didn't work. Thanks!

  • @Maximilyan29
    @Maximilyan29 3 года назад

    Неплохо

  • @ankitrathore3946
    @ankitrathore3946 2 года назад

    BC you broke my system

  • @lynic-0091
    @lynic-0091 Год назад

    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.

  • @FrissOderLassEs
    @FrissOderLassEs Год назад

    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.

  • @veltive3268
    @veltive3268 Год назад

    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#