Jump to content

Varnish final and working config


Recommended Posts

Posted

Hi

 

is there any already VCL file for config varnish work with IP.Board

 

i turned on default varnish setting for my server ...  everything went fine ..

but some problems :

  • users get logged out automatically sometimes
  • the online user list in boardindex was incorrect ( it means the board dont recognize some online users as a ONLINE USER with varnish)

 

plz help

Posted

Can you share you config? Maybe we can see what goes wrong.

Currently we only use Nginx with microcaching for guests and static files (such as stylesheets). It gave our forum a big speed improvement.

Posted

what is microcaching and how can i enable it ?

varnish Config :

#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.

# Marker to tell the VCL compiler that this VCL has been adapted to the
# new 4.0 format.
vcl 4.0;

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    # 
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.
}

sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    # 
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.
}

sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    # 
    # You can do accounting or modifying the final object here.
}

and my nginx conf

 

server {
	listen 80 default_server;
	listen [::]:80 default_server ipv6only=on;

	root /var/www/lion;
	index index.html index.htm index.php;

	# Make site accessible from http://localhost/
	server_name forum.lioncomputer.ir;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		#try_files $uri $uri/ =404;
		try_files  $uri $uri/ /index.php;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules;
	}

	#error_page 404 /404.html;

	# redirect server error pages to the static page /50x.html
	#
	#error_page 500 502 503 504 /50x.html;
	#location = /50x.html {
	#	root /usr/share/nginx/html;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
	#	# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
	#
	#	# With php5-cgi alone:
	#	fastcgi_pass 127.0.0.1:9000;
	#	# With php5-fpm:
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}
}

 

Posted

no

i just disabled the varnish ... so i change nginx conf to listen to 80 ... instead of 8080

 

sorry for bad config copy

 

here is my varnished config version of nginx ;

server {
	listen 8080 default_server;
	listen [::]:8080 default_server ipv6only=on;

	root /var/www/lion;
	index index.html index.htm index.php;

	# Make site accessible from http://localhost/
	server_name forum.lioncomputer.ir;

	location / {
		# First attempt to serve request as file, then
		# as directory, then fall back to displaying a 404.
		#try_files $uri $uri/ =404;
		try_files  $uri $uri/ /index.php;
		# Uncomment to enable naxsi on this location
		# include /etc/nginx/naxsi.rules;
	}

	#error_page 404 /404.html;

	# redirect server error pages to the static page /50x.html
	#
	#error_page 500 502 503 504 /50x.html;
	#location = /50x.html {
	#	root /usr/share/nginx/html;
	#}

	# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
	#
	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
	#	# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
	#
	#	# With php5-cgi alone:
	#	fastcgi_pass 127.0.0.1:9000;
	#	# With php5-fpm:
		fastcgi_pass unix:/var/run/php5-fpm.sock;
		fastcgi_index index.php;
		include fastcgi_params;
	}

	# deny access to .htaccess files, if Apache's document root
	# concurs with nginx's one
	#
	#location ~ /\.ht {
	#	deny all;
	#}
}

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...