Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Find full tutorial at: http://mikeg.de/project/cloud-nginx-server-wordpress/
- worker_processes 1;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- }
- http {
- include mime.types;
- include pagespeed_libraries.conf;
- include fastcgi.conf;
- default_type application/octet-stream;
- log_format main '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" "$http_x_forwarded_for"';
- log_format cache '$remote_addr - $remote_user [$time_local] '
- '"$request" $status $body_bytes_sent '
- '"$http_referer" "$http_user_agent" nocache:$skip_cache '
- '$upstream_cache_status';
- access_log /var/log/nginx/access.log main;
- error_log /var/log/nginx/error.log debug;
- sendfile on;
- keepalive_timeout 65;
- tcp_nodelay on;
- server_names_hash_bucket_size 128;
- pagespeed On;
- pagespeed FileCachePath /var/cache/nginx/ngx_pagespeed;
- pagespeed ModPagespeedRewriteLevel CoreFilters;
- # Use gzip compression
- # gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module
- gzip on;
- 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 text/javascript text/xml application/json application/x-javascript application/xml application/xm$ application/xml+rss image/png image/gif image/jpeg;
- gzip_disable "MSIE [1-6]\.(?!.*SV1)";
- # Fast-CGI cache
- fastcgi_cache_path /var/cache/nginx/wordpress levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
- fastcgi_cache_path /var/cache/nginx/system levels=1:2 keys_zone=SYSTEM:100m inactive=60m;
- fastcgi_cache_key "$scheme$request_method$host$request_uri";
- fastcgi_cache_use_stale error timeout invalid_header http_500;
- add_header X-Cache $upstream_cache_status;
- server {
- listen 80;
- server_name YOUR_AMAZON_IP;
- root /srv/system/;
- index index.html index.htm;
- location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
- location ~ "^/ngx_pagespeed_static/" { }
- location ~ "^/ngx_pagespeed_beacon$" { }
- location /ngx_pagespeed_statistics { allow 127.0.0.1; deny all; }
- location /ngx_pagespeed_global_statistics { allow 127.0.0.1; deny all; }
- location /ngx_pagespeed_message { allow 127.0.0.1; deny all; }
- location /pagespeed_console { allow 127.0.0.1; deny all; }
- location ~ \.php$ {
- fastcgi_cache SYSTEM;
- fastcgi_cache_valid 200 60m;
- include fastcgi_params;
- fastcgi_pass unix:/var/run/php5-fpm.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME $request_filename;
- }
- # Include security configuration
- include sites-available/security.conf;
- }
- # Normalization
- server {
- listen 80;
- # On production sites add IP for good SEO
- server_name www.YOUR_AMAZON_DNS;
- return 301 $scheme://mikeg.de$request_uri;
- }
- server {
- listen 80 default_server;
- server_name YOUR_AMAZON_DNS;
- root /srv/wordpress/;
- index index.php;
- # Turned off since W3 Total Cache will handle caching
- # and mod_pagespeed won't enhance WP: http://wordpress.org/support/topic/plugin-w3-total-cache-googles-mod_pagespeed-and-w3
- pagespeed Off;
- access_log /var/log/nginx/wordpress.log cache;
- error_log /var/log/nginx/wordpress.error.log debug;
- rewrite_log on;
- # Include nginx.conf made by W3 Total Cache
- #include /srv/wordpress/nginx.conf;
- # Include common WordPress configuration
- include sites-available/wordpress-common.conf;
- # Include security configuration
- include sites-available/security.conf;
- # Manual rewrites
- # rewrite ^/your-url.* http://$server_name/ permanent;
- }
- # CDN Sub-Domain configuration with CORS
- server {
- listen 80;
- server_name cdn-01.YOUR_AMAZON_DNS;
- root /srv/wordpress/;
- access_log /var/log/nginx/cdn.wordpress.access.log;
- error_log /var/log/nginx/cdn.wordpress.error.log;
- # Include CDN configuration
- include sites-available/cdn.conf;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement