Configuring php-fpm + nginx bundle under WSL

I am a farmer and in every possible way evade the final transition to Linux on my PC despite all its advantages. Therefore, the last couple of years I used Docker for Windows to create local platforms for projects. Not to say that the thing is super stable, but did not cause significant problems until on one project on Laravel the site began to behave strangely: some requests (and always different parts) returned with an error. The script could not open the cache file.

Having spent a fair amount of time looking for a reason, I decided in this case to abandon Docker and deploy the platform under WSL in manual mode.

Since WSL is almost Linux, i.e. - Not really, the setting has its own characteristics.
After MySQL, nginx and php7.2 were installed from bash, a virtual server was configured in nginx and all this refused to work. The nginx logs had this entry:

 connect() to unix:/var/run/php/php7.2-fpm.sock failed (2: No such file or directory) while connecting to upstream

In WSL, as far as I know, there are no sockets as such, so I had to do the following:

  1. open the file /etc/php/7.2/fpm/pool.d/www.conf for editing, and correct the value of the listen directive

    ; listen = /run/php/php7.2-fpm.sock ; old value
    listen = ; new value
  2. set the same value in nginx virtual server setup

    location ~ \.php$ {

This gave a kind of working server. It seems like because each request from processed ooooooooooooooooooooooooooooooooooooooooooooooo Already at the most time limit. To get rid of the brakes, as it turned out, you should add a line to the file /etc/nginx/nginx.conf

http {
fastcgi_buffering off;

After that, the system took off and so far feels great.

→ The described recipes were found here

P.S. afterwards, I discovered somehow a way to still start a bunch of sockets, but have not yet verified. And one more .

Also popular now: