# configuration file /etc/nginx/vhosts/site.com.conf:
server {
server_name site.com www.site.com;
user www-data;
worker_processes auto;
include /etc/nginx/modules-enabled/*.conf;
error_log /var/log/nginx/error.log error;
pid /var/run/nginx.pid;
#timer_resolution 100ms;
worker_rlimit_nofile 400000;
events {
worker_connections 10000;
multi_accept on;
use epoll;
}
http {
upstream centrifugo {
ip_hash;
server 146.122.12.100:8000;
keepalive 512;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
ssl_session_cache shared:SSL:200m;
ssl_session_timeout 6h;
ssl_prefer_server_ciphers on;
#limit_req_zone $binary_remote_addr zone=one:10m rate=25r/s;
#limit_conn_zone $binary_remote_addr zone=perip:10m;
#limit_conn_zone $server_name zone=perserver:10m;
#limit_conn perip 50;
sendfile on;
sendfile_max_chunk 512k;
proxy_read_timeout 150;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 40s;
keepalive_requests 100;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 64;
reset_timedout_connection on;
client_body_timeout 20s;
client_header_timeout 20s;
send_timeout 20s;
client_body_buffer_size 10m;
client_header_buffer_size 10k;
client_max_body_size 10m;
large_client_header_buffers 4 10k;
gzip on;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/css text/plain text/javascript application/javascript application/json
application/x-javascript application/xml application/xml+rss application/xhtml+xml
application/x-font-ttf application/x-font-opentype application/vnd.ms-fontobject
image/svg+xml image/x-icon application/rss+xml application/atom_xml;
gzip_disable "msie6";
gzip_comp_level 6;
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types application/atom+xml application/javascript application/json application/rss+xml
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml;
open_file_cache max=200000 inactive=40s;
open_file_cache_valid 50s;
open_file_cache_min_uses 4;
open_file_cache_errors on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/vhosts/*.conf;
#use any of the following two
real_ip_header CF-Connecting-IP;
# client_max_body_size 2M;
# client_body_buffer_size 256k;
server {
server_name localhost;
disable_symlinks if_not_owner;
listen 80;
listen [::]:80;
location @fallback {
error_log /dev/null crit;
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off;
}
}
}
server {
server_name site.com www.site.com;
charset UTF-8;
index 404.html;
disable_symlinks if_not_owner from=$root_path;
include /etc/nginx/vhosts-includes/*.conf;
include /etc/nginx/vhosts-resources/site.com/*.conf;
access_log /var/www/httpd-logs/site.com.access.log;
error_log /var/www/httpd-logs/site.com.error.log notice;
ssi on;
set $root_path /var/www/site/data/www/site.com;
root $root_path;
listen 80;
listen 443 ssl http2;
error_page 403 400 404 = http://site.com/404.html;
# return 301 http://$server_name$request_uri;
if ($scheme = https) {
rewrite ^ http://$server_name$request_uri? permanent;
}
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
if ( $http_user_agent ~* (LWP::Simple|BBBike|XSpider|OpenVas|Zeus|DirBuster|acunetix|BTWebClient|nmap|nikto|wikto|sf|sqlmap|bsqlbf|w3af|acunetix|havij|appscan|WordPress) ) {
return 403;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /$1.php;
}
}
if ($request_uri ~ "\.php") {
rewrite ^/(.+)\.php$ /$1 permanent;
}
#limit_conn perserver 260;
location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|js|css|txt|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
access_log off;
expires 7d;
break;
}
location ~ \.(php)$ {
#limit_req zone=one burst=35;
fastcgi_index index.php;
fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f webmaster@site.com";
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
try_files $uri =404;
include fastcgi_params;
}
location = /status-phpfpm {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /status-phpfpm;
fastcgi_pass 127.0.0.1:9000;
access_log off;
}
}
server {
server_name localhost;
disable_symlinks if_not_owner;
listen 80;
listen [::]:80;
location @fallback {
error_log /dev/null crit;
proxy_pass http://127.0.0.1:8080;
proxy_redirect http://127.0.0.1:8080 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
access_log off;
}
}
Если клиенту не было ответа, то он должен еще раз нажать например кнопку, верно понял ?