douchong4730 2014-10-28 02:53
浏览 32
已采纳

Magento将PHP-FPM组分开给管理员

I run a Magento webstore with middling traffic levels, running on NGINX with PHP-FPM. The server environment is very powerful with plenty of overhead, so hardware is not a factor.

We are getting timeouts and errors when running memory intensive operations in the backend, such as exports and some custom indexes.

Ignoring writing more efficient code and increasing pool sizes across the whole site, we want to explore ways to allocate more resources to the backend without having to reduce possible concurrent connections sizes across the site.

It has been suggested that we split the admin of the site to a separate server/IP, with different configs. This would solve our problem, but also be very expensive, and seems like a big leap to solve a non-critical problem.

Is is possible to associate a different PHP FPM config to something like www.example.com/admin, giving users from different URLS different capabilities?

  • 写回答

3条回答 默认 最新

  • doujin4031 2014-10-28 03:08
    关注

    Yes, it's possible.

    In this example, we specify a default pool, pool 1. If the URL is /admin, we will use pool 2.

    http {
        # The usual..
    
        # PHP FPM/FastCGI server
        upstream    php5p1 { server unix:/var/run/php5-fpm-pool-1.sock; }
        upstream    php5p2 { server unix:/var/run/php5-fpm-pool-2.sock; }
    }
    
    server {
    
        # Default is to use pool 1
        set $custom_php_pool    "1";
    
        # If is /admin, we use pool 2
        if ($uri ~* "^/admin/") {
            set $custom_php_pool        "2";
        }
    
        # ...
    
    
        location ~ \.php$ {
    
            # ...
    
            # Pass to PHP FPM/FastCGI server
            if ($custom_php_pool = '1') { fastcgi_pass php5p1; }
            if ($custom_php_pool = '2') { fastcgi_pass php5p2; }
        }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?