Anonymous edits have been disabled on the wiki. If you want to contribute please login or create an account.


Warning for game developers: PCGamingWiki staff members will only ever reach out to you using the official press@pcgamingwiki.com mail address.
Be aware of scammers claiming to be representatives or affiliates of PCGamingWiki who promise a PCGW page for a game key.

User:JRWR/nginx

From PCGamingWiki, the wiki about fixing PC games

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; /api.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 [2600:3c01::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;  
   index index.php index.html index.htm;

   location / {
     try_files $uri $uri/ /index.php?title=$uri&$args;
   }

   location /images { 
		location ~ ^/images/thumb/(archive/)?[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ {
			# Thumbnail handler for MediaWiki
			# This location only matches on a thumbnail's url
			# If the file does not exist we use @thumb to run the thumb.php script
			try_files $uri $uri/ @thumb;
		} 
}

   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;
   }
  
   location /cache       { deny all; }
   location /languages   { deny all; }
   location /maintenance { deny all; }
   location /serialized  { deny all; }
   # Just in case, hide .svn and .git too
   location ~ /.(svn|git)(/|$) { deny all; }
	
   # Hide any .htaccess files
   location ~ /.ht { deny all; }

   location @thumb {
	# Do a rewrite here so that thumb.php gets the correct arguments
	rewrite ^/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2;
	rewrite ^/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ /thumb.php?f=$1&width=$2&archived=1;
    }
 }

server {
listen 173.255.253.94:6502;
#listen [2600:3c01::f03c:91ff:fedf:6c49]:6502;
location / {
root /backup/store/;
}

}