Jump to content

IPS4 - Nginx config


Mihoko Okayami

Recommended Posts

Hello,

(Sorry for my english)

With Nginx, when a user does not have access to a forum, it is a Nginx error that appears and not an IPS error.

When there are too many options on a URL, I get an error nginx.

My setup:

# WWW
server {
	listen 127.0.0.1:8080;
	server_name my-domaine.eu *.my-domaine.eu;
	return 301 http://www.my-domaine.eu$request_uri;
	access_log off;
	error_log off;
}
server {
	listen 127.0.0.1:8080;
	server_name www.my-domaine.eu;
	root /home/bestiaire/htdocs/www;
	access_log off;
	error_log /home/bestiaire/logs/www.my-domaine.eu_error.log;
	rewrite /adminarea$ $scheme://$host$uri/ permanent;
	location / {
		try_files $uri $uri/ /index.php$is_args$args;
	}
	location ~^/adminarea/(.*)$ {
		include /etc/nginx/default.d/php/php-fpm.conf;
		allow 1234:1234:1234:1234::/64;
		allow 123.123.123.123;
		deny all;
		break;
	}
	location ~^(/uploads/).*(.php)$ {
		deny all;
	}
	location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml|htm|txt|swf|cur)$ {
		access_log off;
		expires 1w;
	}
	location ~* conf_global.php { return 404; }
	include /etc/nginx/default.d/php/php-fpm.conf;
	include /etc/nginx/default.d/*.conf;
}


php-fpm.conf
 

location ~* \.php$ {
	try_files $uri =404;
	fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
	fastcgi_index index.php;
	fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	include fastcgi_params;
	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_intercept_errors on;
	fastcgi_ignore_client_abort off;
	fastcgi_connect_timeout 60;
	fastcgi_send_timeout 180;
	fastcgi_read_timeout 180;
	fastcgi_buffers 4 256k;
	fastcgi_buffer_size 128k;
	fastcgi_busy_buffers_size 256k;
	fastcgi_temp_file_write_size 256k;
}

nginx.conf

user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
	worker_connections 1024;
	use epoll;
	multi_accept on;
}
http {
	include /etc/nginx/mime.types;
	index index.html index.php;
	default_type application/octet-stream;
	set_real_ip_from 127.0.0.1;
	real_ip_header X-Forwarded-For; 
	log_format main '$remote_addr - $remote_user [$time_local] "$request" '
					'$status $body_bytes_sent "$http_referer" '
					'"$http_user_agent" "$http_x_forwarded_for"';
	charset utf-8;
	server_tokens off;
	sendfile on;
	tcp_nodelay on;
	keepalive_timeout 65;
	client_body_timeout 30;
	client_header_timeout 30;
	send_timeout 30;
	client_max_body_size 8M;
	reset_timedout_connection on;
	geoip_country /usr/share/GeoIP/GeoLiteCountry.dat;
	geoip_city /usr/share/GeoIP/GeoLiteCity.dat;
	gzip on;
	gzip_disable "MSIE [1-6].(?!.*SV1)";
	gzip_vary on;
	gzip_comp_level 6;
	gzip_proxied any;
	gzip_buffers 16 8k;
	include /etc/nginx/conf.d/*.conf;
}

Port 8080 because I have a Varnish before, it is just proxies, not configured.

Do you have any suggestions for improvement?

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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