nginx,php-fpm 錯誤,而 apache 沒有錯誤

nginx,php-fpm 錯誤,而 apache 沒有錯誤

我有一個使用 nginx、fastcgi 部署的 opencart 應用程式。我使用 RDS 作為 Mysql 伺服器。

最近,我的日誌中出現了此錯誤,並且我對 400 個並髮用戶進行了 siege 負載測試。

FastCGI sent in stderr: "PHP message: PHP Warning: mysqli::mysqli

使用 apache 作為伺服器與 siege 運行相同的負載測試。

這些都是 nginx 的圍攻結果

Transactions:               3246 hits
Availability:              77.80 %
Elapsed time:             146.43 secs
Data transferred:          35.27 MB
Response time:              6.86 secs
Transaction rate:          22.17 trans/sec
Throughput:             0.24 MB/sec
Concurrency:              152.01
Successful transactions:        1049
Failed transactions:             926
Longest transaction:           36.83
Shortest transaction:           0.65

和阿帕奇

Transactions:               7921 hits
Availability:              99.01 %
Elapsed time:             462.60 secs
Data transferred:         218.75 MB
Response time:              9.94 secs
Transaction rate:          17.12 trans/sec
Throughput:             0.47 MB/sec
Concurrency:              170.12
Successful transactions:        4925
Failed transactions:              79
Longest transaction:          114.25
Shortest transaction:           0.59

這些是 nginx 和 fpm conf :

user www-data;
worker_processes 1;
pid /run/nginx.pid;

events {
        worker_connections 1024;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        # Compression

        # Enable Gzip compressed.
        gzip on;
        # Enable compression both for HTTP/1.0 and HTTP/1.1.
        #gzip_http_version  1.1;

        # Compression level (1-9).
        # 5 is a perfect compromise between size and cpu usage, offering about
        # 75% reduction for most ascii files (almost identical to level 9).
        gzip_comp_level    4;

        # Don't compress anything that's already small and unlikely to shrink much
        # if at all (the default is 20 bytes, which is bad as that usually leads to
        # larger files after gzipping).
        gzip_min_length    256;

        # Compress data even for clients that are connecting to us via proxies,
        # identified by the "Via" header (required for CloudFront).
        gzip_proxied       any;

        # Tell proxies to cache both the gzipped and regular version of a resource
        # whenever the client's Accept-Encoding capabilities header varies;
        # Avoids the issue where a non-gzip capable client (which is extremely rare
        # today) would display gibberish if their proxy gave them the gzipped version.
        gzip_vary          on;

        # Compress all output labeled with one of the following MIME-types.
        gzip_types
          application/atom+xml
          application/javascript
          application/x-javascript
          application/json
          application/rss+xml
          application/vnd.ms-fontobject
          application/x-font-ttf
          application/x-web-app-manifest+json
          application/xhtml+xml
          application/xml
          font/opentype
          image/svg+xml
          image/x-icon
          text/css
          text/plain
          text/x-component
          text/xml
          text/javascript
          text/x-javascript
        # text/html is always compressed by HttpGzipModule


        ##
        # nginx-naxsi config
        ##
        # Uncomment it if you installed nginx-naxsi
        ##
        #include /etc/nginx/naxsi_core.rules;

        ##
        # nginx-passenger config
        ##
        # Uncomment it if you installed nginx-passenger
        ##

        #passenger_root /usr;
        #passenger_ruby /usr/bin/ruby;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

相關內容