wordpress - Nginx performance problems -
i having performance problems website. configuration 1g vps wordpress/nginx/php-fpm on ubuntu 11.04. bottleneck when browser waiting first byte server. takes 4-6 secs waiting first response server after initiating connection (the website new , receives low traffic currenlty , 50-150 visit/day). following nginx conf, hope may understanding problem is. want know if there wrong configuration may optimized. if can recommend me profiling/analysis tools use suits configuration.
note: replaced username myusername, domain mydomain.com
nginx.conf
user myusername; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 768; # multi_accept on; } http { index index.php index.html index.htm; sendfile on; # tcp_nopush on; tcp_nodelay on; keepalive_timeout 5; 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; client_max_body_size 50m; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; 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 ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } sites-enabled/default
server { listen 80; ## listen ipv4; line default , implied listen [::]:80 default ipv6only=on; ## listen ipv6 root /home/myusername/www; # make site accessible http://localhost/ server_name mydomain.com; location / { # first attempt serve request file, # directory, fall index.html try_files $uri $uri/ /index.php; } location /doc { # root /usr/share; autoindex on; allow 127.0.0.1; deny all; } location /images { # root /usr/share; autoindex off; } error_page 404 = @wordpress; log_not_found off; location @wordpress { fastcgi_pass 127.0.0.1:9000; fastcgi_param script_filename $document_root/index.php; include /etc/nginx/fastcgi_params; fastcgi_param script_name /index.php; } location ^~ /files/ { rewrite /files/(.+) /wp-includes/ms-files.php?file=$1 last; } # redirect server error pages static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /usr/share/nginx/www; #} # proxy php scripts apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass php scripts fastcgi server listening on 127.0.0.1:9000 # location ~ \.php$ { try_files $uri @wordpress; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param script_filename $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } # deny access .htaccess files, if apache's document root # concurs nginx's 1 # location ~ /\.ht { deny all; } location ^~ /blogs.dir/ { internal; root /home/myusername/www/wp-content; } }
looks wordpress site, i'd lean more towards being performance problem there nginx config itself.
some recommendations:
1 - make sure have apc installed , enabled
2 - install server-side caching plugin (w3 total cache or supercache) , configure use apc backing store (and turn on of caching layers)
as far profilers go, i'm huge fan of newrelic , pro level free first 2 weeks (usually long enough find hot spots) basic performance information free forever.
Comments
Post a Comment