cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar









Etc


Reference














.

middleware:web:nginx:conf:phpfpm.html



Nginx Configuration Examples

Nginx Sample Configuration of php-fpm (Use TCP or Socket)

/etc/nginx/conf.d/sample.conf

How to use TCP

Check TCP

# netstat -an |grep 127.0.0.1:9000

TCP Configuration Examples

server {
    listen  80;
    server_name localhost 192.168.0.10;

    root    /var/www;
    index   index.php index.html;

    location ~ .(php|html|htm)$ {
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }

}


How to use SOCKET

Check SOCKET

# netstat -a --unix |grep php
unix  2      [ ACC ]     STREAM     LISTENING     211772   /run/php/php7.4-fpm.sock

TCP Configuration

server {
    listen  80;
    server_name localhost 192.168.0.10;

    root    /var/www;
    index   index.php index.html;

    location ~ .(php|html|htm)$ {
        fastcgi_pass    unix:/run/php/php7.4-fpm.sock;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }

}







middleware/web/nginx/conf/phpfpm.html.txt ยท Last modified: 2021/02/15 by admin

Page Tools