کاربر:Admin/صفحه تمرین/Nginx default

از ویکی‌کد، دانشنامهٔ برنامه‌نویسی
پرش به ناوبری پرش به جستجو
server {

	listen 80 default_server;
	listen [::]:80 default_server;

	client_header_timeout 3000;
	client_body_timeout 3000;
	fastcgi_read_timeout 3000;
	client_max_body_size 32m;
	fastcgi_buffers 8 128k;
	fastcgi_buffer_size 128k;

	server_name wiki-howzeh.ir www.wiki-howzeh.ir;

	root /home/sokot/public_html;

	index index.php index.html index.htm ;

	location /w {
		try_files $uri $uri/ @rewrite;
	}

	location @rewrite {
		rewrite ^/wiki(.*)$ /w/index.php?title=$1&$args;
	}

#	location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
	#	root /home/sokot/public_html/w;
	#	try_files $uri /w/index.php;
	#	expires max;
	#	log_not_found off;
	#}

	location /dumps {
	    root /home/sokot/public_html/w/local;
		autoindex on;
	}

	location /images {
        root /home/sokot/public_html/w;
	    # Separate location for images/ so .php execution won't apply
	}

	location /images/deleted {
        root /home/sokot/public_html/w;
        # Deny access to deleted images folder
        deny    all;
	}

	# Deny access to folders MediaWiki has a .htaccess deny in
    location /cache {
        root /home/sokot/public_html/w;
        deny    all;
    }

	location /languages   {
        root /home/sokot/public_html/w;
        deny    all;
    }

	location /maintenance {
        root /home/sokot/public_html/w;
        deny    all;
    }

	location /serialized  {
        root /home/sokot/public_html/w;
        deny    all;
    }

	# Just in case, hide .svn and .git too
	location ~ /.(svn|git)(/|$) {
        root /home/sokot/public_html/w;
        deny    all;
    }

	# Hide any .htaccess files
	location ~ /.ht {
        root /home/sokot/public_html/w;
        deny    all;
    }

	# Uncomment the following code if you wish to hide the installer/updater
	## Deny access to the installer
	location /mw-config {
        root /home/sokot/public_html/w;
        deny    all;
    }
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}