Create a Symfony 5 project with Docker PHP MySQL Nginx and Node - Part1 (2021)

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 91

  • @GaryClarkeTech
    @GaryClarkeTech  4 роки тому +5

    If you encounter any breaks with webpack encore when using node v15, try changing docker-compose.yaml to specify node:14

  • @almerinobuce7878
    @almerinobuce7878 2 роки тому +3

    I was looking for something like this for a while, here i found everything. Great tutorial.

  • @jahoopyjaheepu497
    @jahoopyjaheepu497 3 роки тому +1

    Thank you for making this video. I've watched many hours of Docker tutorials this week after learning the basics, and this has been the only tutorial where things were explained very clearly. The bit about how to set up an nginx config file was invaluable.

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Hey Jahoopy that's great. I'm glad I was able to help 🤝

    • @jahoopyjaheepu497
      @jahoopyjaheepu497 3 роки тому

      @@GaryClarkeTech Thank you!
      I do have one question though (if you don't mind taking a moment to answer). I'm fairly new to Docker, and I'm having an issue using the setup in this video where every other PHP page in the public folder returns a 404, except the index page. For example, localhost:8080/example.php returns a 404. I changed some things in the nginx config file to possibly remedy this (like the part at the bottom that forces a 404 on everything but index.php), but that just makes me download my script when I go to that script's page.
      Do you know why this is still happening, and how to fix it?

    • @jahoopyjaheepu497
      @jahoopyjaheepu497 3 роки тому +1

      Actually, I solved this by doing some trial and error with my config script. Stack Overflow helped a lot too, but ultimately I just had to put the things from the location index.php brackets into a new "location" that looks like this: location ~ \.php$ (I suppose this is for any file/page that ends in .php).

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      @@jahoopyjaheepu497 Glad you figured it out!

  • @goncalosardinha5020
    @goncalosardinha5020 4 роки тому +3

    Great explanation with a very relaxed and easy to understand vibe!
    Thank you and keep the excelent work.

  • @nordicnoirmusic
    @nordicnoirmusic Рік тому

    Thanks for the effort, Gary. I was able to get it running in no time!

  • @phoenlx_3
    @phoenlx_3 2 роки тому

    This should help me! I've been trying to do this on my own for all day (except the node part, but I'll keep it on mind, it'll maybe be useful for a future project) switching between apache and nginx, both resulting in the same error : fcgi returning error.
    Gonna try ur solution tomorrow, I hope it works this time!
    Your tutorial is really good anyway, you explain well with a very comprehensive English for a French student like me. Thanks a lot for that!

    • @phoenlx_3
      @phoenlx_3 2 роки тому

      Update : it worked ! thank you so much for this vid. I just had to make a few changes, like choosing a more recent version of php and edit the Dockerfile for the php container (the mv instruction is returning an error since now it's not /root/.symfony/(...) but /root/.symfony5/(...)

    • @GaryClarkeTech
      @GaryClarkeTech  2 роки тому +2

      @@phoenlx_3 Hey that's awesome..so glad it worked! This video is over 2 years old now so I am currently working on a new PHP + Docker tutorial which will use PHP MySQL Nginx and Redis and I'm also gonna show how to push the app to production on AWS. You'll really like it.

  • @dirkkuijer8440
    @dirkkuijer8440 7 місяців тому

    Great teachter is mister Clarke!

  • @lexerquine3008
    @lexerquine3008 2 роки тому

    thank you so much for this guide, few guides work right away and are modifiable for other projects. you have nailed it. keep up the great work my friend.

  • @shurbioto1034
    @shurbioto1034 2 роки тому

    Thsnk you very much, you are my hero. I was traying to init a symfony app with docker and i was having a lot of problem to serve the statics files. Thansk to you I have succeeded :))))))

    • @GaryClarkeTech
      @GaryClarkeTech  2 роки тому

      Glad I could help...I'll probably release an updated Symfony + Docker video in the next few months

  • @d.k.353
    @d.k.353 4 роки тому +2

    Hey Gary, this is a great tutorial, thanks for that!

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому

      Thanks buddy, I appreciate that. There'll be more to come so be sure to subscribe!

  • @PrincessSarahjayne11
    @PrincessSarahjayne11 2 роки тому

    Great video - it worked first time for me so I was super happy .... I hate configurating things, but this made it easy. Thank you for saving me a headache :)

  • @domasdragunas2954
    @domasdragunas2954 2 роки тому

    Could not be better. Thank you so much

  • @Zoddxyz
    @Zoddxyz 3 роки тому

    Thank you very much for your video. Very easy to understand the base concept!

  • @flashbangstudio9102
    @flashbangstudio9102 4 роки тому

    Exactly what i need to set up ! i'm excited, Thanks you so much.

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому +1

      You're welcome, friend. Glad I could help!

  • @michaelbrauner
    @michaelbrauner 2 роки тому +1

    Hello Gary. Is there any reason for you not to use the unix socket for connecting php-fpm and nginx?

    • @GaryClarkeTech
      @GaryClarkeTech  2 роки тому

      Only that I don't know a lot about it 😂 It's not my area of expertise. But I'm gonna do more Docker in about 3 months so I'll upskill before then. Feel free to share any links on the subject!

  • @muzika5001
    @muzika5001 2 роки тому

    Amazing tutorial! Thank you very much!

  • @adm-frg
    @adm-frg 2 роки тому

    Thanks for this awesome tutorial !

  • @katerynaiaroshenko4057
    @katerynaiaroshenko4057 3 роки тому

    Thank you so much!!! Everything works at once! 🥰

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Amazing! The video is nearly a year old now, so I'm glad to hear everything still works!

  • @yongzhang2983
    @yongzhang2983 3 роки тому

    Thank you for sharing, it is a great video. What if I have multiple sites under Nginx, and want to keep each host conf in separate file?

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      Thank you, you're welcome. You mean multiple sites on one nginx service? I've always stuck to one site per service.

  • @waltermg117
    @waltermg117 3 роки тому

    very clear, thanks man!

  • @arjan127
    @arjan127 2 роки тому

    This is such a good video, thanks!

  • @MohammadArifRahim
    @MohammadArifRahim 3 роки тому +1

    Hi Gary, thanks, it is a great tutorial. I learned a lot. However, I ran into problem with php installation. While trying to figure out what went wrong, I realized, you were installing the docker on macOS so your dependencies are different then mine. I am using docker on windows 10 with WSL2 is "Debian10" for my port. So the requirements must be different. I did not however follow the recommended Debian way of installing PHP. I did trial and error.
    Here is what I did....
    FROM php:7.4-fpm
    RUN apt-get update && apt-get install -y zlib1g-dev git libicu-dev zip libzip-dev zip \
    && docker-php-ext-install intl opcache pdo pdo_mysql \
    && pecl install apcu \
    && docker-php-ext-enable apcu \
    && docker-php-ext-install zip

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      Thanks Mohammad. I hope you managed to get it to work for you.

    • @MohammadArifRahim
      @MohammadArifRahim 3 роки тому

      @@GaryClarkeTech it seems lot of it has changed after your tutorial. Windows, WSL selection, Symphony everywhere there are lot of update. Maybe you can do a new tutorial on windows, to catch all the changes.
      However, do a Symphony tutorial. From basic to advance. I like your style.
      Thank you.

  • @d_sportello
    @d_sportello 3 роки тому

    Thank you for great explanation!
    I've done it all, but the localhost page didn;t show me that echo from index. It says that "Welcome to nginx! Nginx installed and working, but needs to be configured". Do you have any ideas where I could've made a mistake?
    One thing if it's matters: I've typed php80 sign everywhere, not php74

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      I'm not sure...it could be a number of things.
      The best solution will be to pull my files from github and try those first. Then figure out what the difference is between them and yours.

    • @d_sportello
      @d_sportello 3 роки тому

      ​@@GaryClarkeTech I tried it, now I'm getting "File not found" on that localhost page. Maybe I need to add the path in nano /etc/hosts? but it seems like localhost is already there. Anyway, thanks for the reply and advice Gary!

  • @RdozeTV
    @RdozeTV Рік тому

    What if you need to change something does it take effect immediately or its like you need to restart the docker again

    • @GaryClarkeTech
      @GaryClarkeTech  Рік тому +1

      You won't need to restart for things that are volume-mounted like your src code. For some other things you may have to

  • @valentindobrica9584
    @valentindobrica9584 3 роки тому +1

    Hi brother, my node container doesn't run at all, the rest are fine. thanks for tutorial

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому

      It could possibly be a compatibility issue with a later version of node than the one used in the video.

  • @therealwalim
    @therealwalim 2 роки тому

    Hello, thanks for the tutorial but I have some questions, my app is verly slow (loading on browser taking long time and also running commands on CLI) does the fact that Im using volumes that slows everything ? (Im using docker desktop on windows)

    • @GaryClarkeTech
      @GaryClarkeTech  2 роки тому

      php + docker can be slow on windows but I hear that the latest version of Docker is much quicker.

  • @ahmedhelal174
    @ahmedhelal174 2 роки тому

    Thank you

  • @v.kondratjevs
    @v.kondratjevs 3 роки тому +1

    Nice!

  • @tomatomov9061
    @tomatomov9061 2 роки тому

    Why do we need node for symfony ?

  • @jeromepatron7909
    @jeromepatron7909 3 роки тому

    Hy Gary,
    great tutorial. However, I meet an error when I run the first docker-compose command:
    [...]:~/project$ docker-compose up -d --build
    Creating network "project_nginx-php74-mysql8-node" with the default driver
    Building php74-service
    [+] Building 7.7s (3/3) FINISHED
    => [internal] load build definition from Dockerfile 0.9s
    => => transferring dockerfile: 596B 0.0s
    => [internal] load .dockerignore 1.2s
    => => transferring context: 2B 0.0s
    => ERROR [internal] load metadata for docker.io/library/php:7.4-fpm
    Do you have any idea where this might come from?
    Thanks a lot.

  • @catalinmanea2151
    @catalinmanea2151 3 роки тому

    Thanks bro!

  • @derzskyi1
    @derzskyi1 4 роки тому +1

    What is the meaning of node container?

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому

      It's just a container which is built using a node image. the name node-container is a custom name which I gave to it...it's not essential. The main reason that I included it in the project was for frontend asset compilation...which you can learn all about in part 2. Enjoy!

    • @derzskyi1
      @derzskyi1 4 роки тому

      @@GaryClarkeTech thanks for the quick response!

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому

      @@derzskyi1 Welcome buddy

  • @VinodPal16
    @VinodPal16 2 роки тому

    Hi Sir, I am getting error "502 Bad Gateway / nginx/1.22.0"
    can you help me on this please?

  • @urbanofilho74
    @urbanofilho74 3 роки тому

    show!, fantastical

  • @BelkinJr
    @BelkinJr 4 роки тому +2

    just letting you know, on windows if I establish nginx volume conf like this "- ./nginx/default.conf:/etc/nginx/conf.d/default.conf" then it complains that I'm trying to mount a directory onto a file, this is the solution stackoverflow.com/questions/59018610/docker-error-cannot-start-service-nginx-oci-runtime-create-failed

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому

      Thanks for the heads up Belkin..appreciated. I'll check it out.

    • @BelkinJr
      @BelkinJr 4 роки тому +1

      @@GaryClarkeTech Or better yet map it like this "- ./nginx/conf.d:/etc/nginx/conf.d" because otherwise it makes a separate config folder and doesn't use default.conf that you provide. At least that's how I made it work, I'm open to suggestions :)

  • @hellamaxine
    @hellamaxine 4 роки тому

    My nginx container immediately exits?

    • @hellamaxine
      @hellamaxine 4 роки тому +1

      never mind, i missed a semicolon when setting the fastcgi_pass .
      also, mounting those logs is useful, they helped me debug this

    • @GaryClarkeTech
      @GaryClarkeTech  4 роки тому +1

      Definitely...server config is never straight forward for me! I'm glad you got it working.

  • @abdulmobeen2477
    @abdulmobeen2477 3 роки тому

    Hi Gary, I am getting this "File not found." on localhost:8080/ , can you please help me.

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      Hey Abdul...I wanna help you but can you give me a bit more info?
      e.g. At what point is it happening? What steps have you taken to fix it so far? What results did you get from your debugging?

    • @abdulmobeen2477
      @abdulmobeen2477 3 роки тому

      @@GaryClarkeTech I didn't create the app folder that's working now,
      but now if I have a sub dir inside /app like /app/mydir/abc.html, I can't view that file from localhost:8080/app/mydir/abc.html, and nginx show the same file i.e index.php like you showed in the tutorial.

    • @yanndeo9501
      @yanndeo9501 3 роки тому

      hi abdul , how do you solve his. i have a same error

    • @abdulmobeen2477
      @abdulmobeen2477 3 роки тому

      @@yanndeo9501 you need to create app folder then create the index files inside that so that server can serve it.

    • @yanndeo9501
      @yanndeo9501 3 роки тому

      @@abdulmobeen2477 yes i have a app folder like this : app/public/index.php ; i'am getting file not found and node-container not run

  • @Kolarian666
    @Kolarian666 2 роки тому

    +

  • @georgegoldmanonyidikachijo3784
    @georgegoldmanonyidikachijo3784 2 роки тому

    Not working for me... 🥵

  • @MrKenano99
    @MrKenano99 3 роки тому +1

    thanks a lot that was easy and great. But I had problem when run mysql it kept restarting with error message :
    "
    [ERROR] [Entrypoint]: MYSQL_USER="root", MYSQL PASSWORD cannot be used for the root user Use one of the following to control the root user password: - MYSQL_ROOT_PASSWORD - MYSQL_ALLOW_EMPTY_PASSWORD - MYSQL_RANDOM_ROOT_PASSWORD
    "
    But when I commented MYSQL_USER: root and MYSQL_PASSWORD: secret it worked. I did not understand why but it works lol

    • @GaryClarkeTech
      @GaryClarkeTech  3 роки тому +1

      MYSQL_ALLOW_EMPTY_PASSWORD is quite a common setting in dev so you could use that
      Not knowing why something works is scarier than not knowing why it doesn't 😂

    • @MrKenano99
      @MrKenano99 3 роки тому

      Lol! I don't like the say: if it's works don't touch it also. Thanks again 😊