我的服务器有 512 MB 内存。nginx.conf 设置是
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
#tcp_nopush on;
#tcp_nodelay on;
keepalive_timeout 3;
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
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# Virtual Host Configs
##
upstream php {
server 127.0.0.1:9000;
}
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Run Code Online (Sandbox Code Playgroud)
我的 php fpm 配置是
user = www-data
group = www-data
pm = dynamic
pm.max_children = 50
pm.start_servers = 25
pm.min_spare_servers = 8
pm.max_spare_servers = 40
Run Code Online (Sandbox Code Playgroud)
我正在使用一个 wordpress 网站。但它太慢了。我有另一个 512 MB 的服务器用于办公室。它使用 apache 并且比 nginx + phpfpm 更快。我的配置有什么问题吗?
内存使用
最佳成绩
最初不要启动这么多 php 服务器,也许也考虑在没有这段代码的情况下进行测试:
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
Run Code Online (Sandbox Code Playgroud)
在我看来,您最初尝试使用 php 将太多内容加载到 ram 中,但根据顶部的内存使用情况,听起来您的网站有点资源密集型,您是否考虑过像 APC 这样的操作码缓存器?http://pecl.php.net/APC
归档时间: |
|
查看次数: |
27958 次 |
最近记录: |