Difference between revisions of "User:JRWR/nginx"
From PCGamingWiki, the wiki about fixing PC games
Line 65: | Line 65: | ||
<pre> | <pre> | ||
map $uri $bypasspiwik { default 0; /piwik/piwik.php 1; /apc_info.php 1; } | map $uri $bypasspiwik { default 0; /piwik/piwik.php 1; /apc_info.php 1; } | ||
− | + | map $request_uri $bypasspiwik { default 0; ~*^/index\.php\?title=Special:.*$ 1; ~*^/wiki/Special:.*$ 1;} | |
server { | server { | ||
listen 173.255.253.94:80; | listen 173.255.253.94:80; |
Revision as of 05:29, 16 March 2012
nginx.conf
user www-data; worker_processes 8; pid /var/run/nginx.pid; worker_rlimit_nofile 65000; events { worker_connections 2048; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; 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; fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=one:500m; ## # Virtual Host Configs ## include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
httpblockwiki.conf
map $uri $bypasspiwik { default 0; /piwik/piwik.php 1; /apc_info.php 1; } map $request_uri $bypasspiwik { default 0; ~*^/index\.php\?title=Special:.*$ 1; ~*^/wiki/Special:.*$ 1;} server { listen 173.255.253.94:80; listen 127.0.0.1:80; # listen [fe80::f03c:91ff:fedf:6c49]:80; server_name _; client_max_body_size 4m; root /var/www/; server_name_in_redirect off; error_page 502 503 504 /error.html; location / { index index.php; # error_page 404 = @mediawiki; try_files $uri $uri/ /index.php?title=$uri&$args; } # location @mediawiki { # rewrite ^/([^?]*)(?:\?(.*))? /index.php?title=$1&$2 last; # } location ~ \.php?$ { include /etc/nginx/fastcgi_params; fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_cache_valid 200 302 5m; fastcgi_cache_valid 301 1h; fastcgi_cache_valid any 1m; fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale updating error timeout invalid_header http_500; fastcgi_cache one; add_header X-Cache-Status $upstream_cache_status; add_header X-Upstream-Time $upstream_response_time; fastcgi_ignore_headers X-Accel-Expires X-Accel-Redirect Expires Cache-Control Set-Cookie; fastcgi_no_cache $bypasspiwik $cookie_piwik_auth $cookie_pcgamingwiki_pcgwiki_UserName $cookie_pcgamingwiki_pcgwiki_Token; fastcgi_cache_bypass $bypasspiwik $cookie_piwik_auth $cookie_pcgamingwiki_pcgwiki_UserName $cookie_pcgamingwiki_pcgwiki_Token; } location /nginx_status { # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/ stub_status on; access_log off; } location /dumps/ { autoindex on; } } server { listen 173.255.253.94:6502; #listen [fe80::f03c:91ff:fedf:6c49]:6502; location / { root /backup/store/; } }