0

I have a problem with Nginx Cache and wordpress.

info: Nginx and WP working but if i try with the cache some problems.

when active cache nginx

Log nginx =

[alert] 19958#0: worker process 19963 exited on signal 9
[alert] 19958#0: worker process 19966 exited on signal 9
[alert] 19958#0: worker process 19961 exited on signal 9
[alert] 19958#0: worker process 19965 exited on signal 9
[alert] 19958#0: worker process 19970 exited on signal 9
[alert] 19958#0: worker process 19968 exited on signal 9
[alert] 19958#0: worker process 19962 exited on signal 9
[alert] 19958#0: worker process 19967 exited on signal 9
[alert] 19958#0: worker process 19959 exited on signal 9
[alert] 19958#0: worker process 19960 exited on signal 9
[alert] 19958#0: worker process 19969 exited on signal 9

I restart apache and nginx same problem

I don't understand where is the problem in my config.

If somebody can help me ,his would be very nice

nginx.conf

user www-data;
worker_processes 12;
pid /var/run/nginx.pid;

events {
        worker_connections 1024;
}

http {
        ##
        # Basic Settings
        ##
        limit_req_zone $binary_remote_addr zone=one:10m rate=5r/s;
        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 60;
        types_hash_max_size 2048;
        set_real_ip_from 127.0.0.1;
        real_ip_header X-Forwarded-For;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

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

sites-avalaible - mywebsite.com

server setup

proxy_cache_path /home/mywebsite/cache/nginx levels=1:2 keys_zone=staticfilecache:180m
max_size=2500m;
proxy_read_timeout 170;
proxy_send_timeout 90;
proxy_cache_key "$scheme$host$request_uri";
upstream apache {
server 127.0.0.1:8080;
}

server {
listen 80;
server_name www.mywebsite.com;
access_log  /home/mywebsite/logs/access.log;
error_log   /home/mywebsite/logs/error.log;
add_header X-Cache-Status $upstream_cache_status;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_cache_valid 200 20m;
client_max_body_size       2090m;
proxy_connect_timeout      90;
proxy_buffer_size          2024k;
proxy_buffers               8 512k;
proxy_buffering                 on;
proxy_busy_buffers_size     2024k;
proxy_temp_file_write_size 2024k;
proxy_ignore_client_abort on;
proxy_http_version 1.1;

location / {
limit_req   zone=one burst=8 nodelay;
limit_rate 5000k;

# If logged in, don't cache.
if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
set $do_not_cache 1;
}
proxy_no_cache $do_not_cache;
proxy_cache_bypass $do_not_cache;
proxy_cache staticfilecache;
proxy_pass http://apache;
proxy_cache_valid 200 20m;
}

location ~* wp-.*.php|wp-admin {
proxy_pass http://apache;
}
location ~* .(jpg|png|gif|jpeg|css|js|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx|ico)$ {
proxy_cache staticfilecache;
proxy_pass http://apache;
proxy_cache_valid 200 120m;
expires 15552000;
}
location ~* /[^/]+/(feed|.xml)/? {
if ($http_cookie ~* "comment_author_|wordpress_(?!test_cookie)|wp-postpass_" ) {
set $do_not_cache 1;
}
proxy_no_cache $do_not_cache;
proxy_cache_bypass $do_not_cache;
proxy_cache staticfilecache;
proxy_pass http://apache;
proxy_cache_valid 200 45m;
expires 3600;
}
location = /50x.html {
root /var/www/nginx-default;
}
# No access to .htaccess files.
location ~ /.ht {
deny all;
}
}
## Listen banned IP addresses via blockips.conf   ##
 include blockips.conf;
2
  • 1
    Check your system logs. Oct 9, 2015 at 16:09
  • nothing in the syslog or others log, just in /var/log/nginx/error.log , i think my config nginx is not good
    – soso93
    Oct 9, 2015 at 22:00

0

You must log in to answer this question.

Browse other questions tagged .