Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /etc/nginx/nginx.conf
- user www;
- worker_processes 2;
- worker_rlimit_nofile 16392;
- pid /var/run/nginx.pid;
- events {
- worker_connections 1024;
- use epoll;
- multi_accept on;
- }
- http {
- sendfile on;
- tcp_nopush on;
- tcp_nodelay off;
- port_in_redirect off;
- server_tokens off;
- server_names_hash_bucket_size 128;
- types_hash_max_size 16392;
- map_hash_bucket_size 128;
- client_header_timeout 10;
- send_timeout 10;
- client_max_body_size 200M;
- client_body_buffer_size 8M;
- # --- file cache ---
- open_file_cache max=1024 inactive=20s;
- open_file_cache_valid 30s;
- open_file_cache_min_uses 2;
- open_file_cache_errors on;
- # --- Defaults ---
- default_type text/html;
- index index.php index.html index.htm;
- # --- Mime-type table ---
- include mime.types;
- # --- SSL ---
- ssl_prefer_server_ciphers on;
- ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
- ssl_session_cache shared:SSL:10m;
- ssl_session_timeout 10m;
- ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:AES128-GCM-SHA256:AES128-SHA:HIGH:!ADH:!EXP:!LOW:!RC2:!3DES:!SEED:!MD5:!aNULL:!EDH:!CAMELLIA:!MEDIUM:!RC4:!eNULL;
- # --- Logging ---
- log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $request_time';
- log_format blocked '$time_local: Blocked request from $remote_addr $request';
- log_format post '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for" $request_time $upstream_response_time $body_bytes_sent $request_body';
- access_log syslog:server=unix:/dev/log,facility=local7,tag=nginx,severity=notice;
- error_log syslog:server=unix:/dev/log,facility=local7,tag=nginx,severity=error;
- # --- Gzip ---
- gzip on;
- gzip_disable "msie6";
- gzip_vary on;
- gzip_min_length 100;
- gzip_http_version 1.1;
- gzip_comp_level 1;
- gzip_proxied any;
- gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml application/xml+rss application/json image/svg+xml;
- gzip_buffers 128 16k;
- # --- memcached servers ---
- upstream memcached {
- server unix:/var/run/memcached/memcached.sock;
- }
- # --- PHP-FPM ---
- upstream php-fpm {
- server unix:/var/run/php5-fpm.sock;
- }
- server {
- listen 80 default_server;
- server_name __;
- root /var/www/;
- set $memcached_raw_key $scheme://$host$request_uri;
- set $memcached_key data-$memcached_raw_key;
- set $memcached_request 0;
- if ($request_method = POST ) {
- set $memcached_request 0;
- }
- if ( $uri ~ "/wp-" ) {
- set $memcached_request 0;
- }
- if ( $args ) {
- set $memcached_request 0;
- }
- if ($http_cookie ~* "comment_author_|wordpressuser_|wp-postpass_|wordpress_logged_in_" ) {
- set $memcached_request 0;
- }
- location @fallback {
- fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
- fastcgi_param SCRIPT_FILENAME $document_root$script_name;
- fastcgi_param PATH_TRANSLATED $document_root$path_info;
- include params/fastcgi;
- fastcgi_keep_conn on;
- fastcgi_pass php-fpm;
- }
- location ~ ^(?<script_name>.+?\.php)(?<path_info>.*)$ {
- default_type text/html;
- if ( $memcached_request = 1) {
- memcached_pass memcached;
- error_page 404 = @fallback;
- }
- fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
- fastcgi_param SCRIPT_FILENAME $document_root$script_name;
- fastcgi_param PATH_TRANSLATED $document_root$path_info;
- include params/fastcgi;
- fastcgi_keep_conn on;
- fastcgi_pass php-fpm;
- }
- location / {
- try_files $uri $uri/ @rewrites;
- }
- location @rewrites {
- rewrite ^ /index.php last;
- }
- }
- }
- params/fastcgi:
- fastcgi_param SCRIPT_NAME $script_name;
- fastcgi_param PATH_INFO $path_info;
- fastcgi_param QUERY_STRING $query_string;
- fastcgi_param REQUEST_METHOD $request_method;
- fastcgi_param CONTENT_TYPE $content_type;
- fastcgi_param CONTENT_LENGTH $content_length;
- fastcgi_param SCRIPT_NAME $script_name;
- fastcgi_param REQUEST_URI $request_uri;
- fastcgi_param DOCUMENT_URI $document_uri;
- fastcgi_param DOCUMENT_ROOT $document_root;
- fastcgi_param SERVER_PROTOCOL $server_protocol;
- fastcgi_param GATEWAY_INTERFACE CGI/1.1;
- fastcgi_param SERVER_SOFTWARE nginx;
- fastcgi_param REMOTE_ADDR $remote_addr;
- fastcgi_param REMOTE_PORT $remote_port;
- fastcgi_param SERVER_ADDR $server_addr;
- fastcgi_param SERVER_PORT $server_port;
- fastcgi_param SERVER_NAME $server_name;
- fastcgi_param HTTPS $https if_not_empty;
- fastcgi_param SSL_PROTOCOL $ssl_protocol if_not_empty;
- fastcgi_param SSL_CIPHER $ssl_cipher if_not_empty;
- fastcgi_param SSL_SESSION_ID $ssl_session_id if_not_empty;
- fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify if_not_empty;
- fastcgi_param REDIRECT_STATUS 200;
- fastcgi_index index.php;
- fastcgi_connect_timeout 10;
- fastcgi_send_timeout 360;
- fastcgi_read_timeout 3600;
- fastcgi_buffer_size 512k;
- fastcgi_buffers 512 512k;
- fastcgi_intercept_errors on;
- fastcgi_split_path_info ^(?<script_name>.+?\.php)(?<path_info>.*)$;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement