Nginx连接PHP-FPM

准备

  • 安装Nginx
  • 安装PHP-FPM

Nginx连接PHP-FPM

  • 添加子配置
# vim /etc/nginx/conf.d/your.site.com.conf
server {
        listen 80;
        server_name your.site.com;

        root /data/www/your.site.com;
        index index.php index.html index.htm;

        charset utf-8;
        client_max_body_size 128M;

        access_log /var/log/nginx/access-your.site.com.log main;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        location ~ \.php$ {
                try_files $uri = 404;
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }
}
  • 检测配置并重启Nginx
    # nginx -t
    # /etc/init.d/nginx restart
    

你可能感兴趣的:(Nginx连接PHP-FPM)