Nginx + php5-fpm + CodeIgniter 响应太慢

Nginx + php5-fpm + CodeIgniter 响应太慢

我在 Ubuntu 12.04 LTS 上安装了 nginx、php5-fpm 并设置了带有 REST 控制器的 codeigniter。配置有效,但有时响应太慢,即使只有一个用户。有时 nginx 会以 504 状态代码响应。请参阅下面的配置文件片段。此外,如果我需要提供更多配置信息,请告诉我。

谢谢。

    location / {                                                                                                                                                                                       
            # First attempt to serve request as file, then                                                                                                                                             
            # as directory, then fall back to index.html                                                                                                                                               
            try_files $uri $uri/ /index.php;                                                                                                                                                           
            # Uncomment to enable naxsi on this location                                                                                                                                               
            # include /etc/nginx/naxsi.rules                                                                                                                                                           
    }                                                                                                                                                                                                  

    location /doc/ {                                                                                                                                                                                   
            alias /usr/share/doc/;                                                                                                                                                                     
            autoindex on;                                                                                                                                                                              
            allow 127.0.0.1;                                                                                                                                                                           
            deny all;                                                                                                                                                                                  
    }                                                                                                                                                                                                  

    # Only for nginx-naxsi : process denied requests                                                                                                                                                   
    #location /RequestDenied {                                                                                                                                                                         
            # For example, return an error code                                                                                                                                                        
            #return 418;                                                                                                                                                                               
    #}                                                                                                                                                                                                 

    error_page 404 /404.html;                                                                                                                                                                          

    # redirect server error pages to the static page /50x.html                                                                                                                                         
    #                                                                                                                                                                                                  
    #error_page 500 502 503 504 /50x.html;                                                                                                                                                             
    #location = /50x.html {                                                                                                                                                                            
    #       root /usr/share/nginx/www;                                                                                                                                                                 
    #}                                                                                                                                                                                                 

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000                                                                                                                               
    #                                                                                                                                                                                                  
    location ~ \.php$ {                                                                                                                                                                                
    #       fastcgi_split_path_info ^(.+\.php)(/.+)$;                                                                                                                                                  
    #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini                                                                                                                                 
    #                                                                                                                                                                                                  
    #       # With php5-cgi alone:                                                                                                                                                                     
              #     fastcgi_pass 127.0.0.1:9000;                                                                                                                                                       
    #       # With php5-fpm:                                                                                                                                                                           
            fastcgi_pass unix:/var/run/php5-fpm.sock;                                                                                                                                                  
            fastcgi_index index.php;                                                                                                                                                                   
            include fastcgi_params;                                                                                                                                                                    
    }                                                                                                                                                                                                  

相关内容