Как провести настройку nginx + php5-fpm?
Не могу никак решить вопрос настройки данного зверя.
Ubuntu 12.04 x64, nginx-1.4.5.
Конфиги:
nginx.conf
user www-data; worker_processes 2; pid /run/nginx.pid; events { worker_connections 1024; } http { sendfile on; keepalive_timeout 5 5; types_hash_max_size 2048; server_tokens off; limit_conn_zone $binary_remote_addr zone=one:3m; #include /etc/nginx/mime.types; #default_type application/octet-stream; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable «msie6»; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { if ($request_method !~ ^(GET|HEAD|POST)$ ) { return 444; } if ($http_user_agent ~* LWP::Simple|BBBike|wget) { return 403; } if ($http_user_agent ~* msnbot|scrapbot) { return 403; } if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) ) { return 403; } limit_conn one 10; location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_ignore_client_abort off; include fastcgi_params; try_files $uri $uri/ $uri/index.php?q=$uri&$args $uri/index.php =405; } } }
конфиг хоста
server { listen 80; server_name site.ru; location / { rewrite ^/(.*)$ https://$host/$1 permanent; } } server { listen 443 ssl; server_name site.ru; client_body_buffer_size 1K; client_header_buffer_size 1k; client_max_body_size 1k; large_client_header_buffers 2 1k; client_body_timeout 10; client_header_timeout 10; keepalive_timeout 5 5; send_timeout 10; if ($host !~ ^(site.ru|www.site.ru)$ ) { return 444; } location / { index index.php index.html index.htm; gzip_static on; root /var/www/site; } location /images/ { valid_referers none blocked www.site.ru site.ru; if ($invalid_referer) { return 403; } } error_page 404 /404.html; location = /404.html { root /var/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/nginx/html; } }
Ubuntu 12.04 x64, nginx-1.4.5.
Конфиги:
nginx.conf
user www-data; worker_processes 2; pid /run/nginx.pid; events { worker_connections 1024; } http { sendfile on; keepalive_timeout 5 5; types_hash_max_size 2048; server_tokens off; limit_conn_zone $binary_remote_addr zone=one:3m; #include /etc/nginx/mime.types; #default_type application/octet-stream; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable «msie6»; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; server { if ($request_method !~ ^(GET|HEAD|POST)$ ) { return 444; } if ($http_user_agent ~* LWP::Simple|BBBike|wget) { return 403; } if ($http_user_agent ~* msnbot|scrapbot) { return 403; } if ( $http_referer ~* (babes|forsale|girl|jewelry|love|nudit|organic|poker|porn|sex|teen) ) { return 403; } limit_conn one 10; location ~ \.php$ { fastcgi_pass unix:/var/run/php-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_ignore_client_abort off; include fastcgi_params; try_files $uri $uri/ $uri/index.php?q=$uri&$args $uri/index.php =405; } } }
конфиг хоста
server { listen 80; server_name site.ru; location / { rewrite ^/(.*)$ https://$host/$1 permanent; } } server { listen 443 ssl; server_name site.ru; client_body_buffer_size 1K; client_header_buffer_size 1k; client_max_body_size 1k; large_client_header_buffers 2 1k; client_body_timeout 10; client_header_timeout 10; keepalive_timeout 5 5; send_timeout 10; if ($host !~ ^(site.ru|www.site.ru)$ ) { return 444; } location / { index index.php index.html index.htm; gzip_static on; root /var/www/site; } location /images/ { valid_referers none blocked www.site.ru site.ru; if ($invalid_referer) { return 403; } } error_page 404 /404.html; location = /404.html { root /var/nginx/html; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/nginx/html; } }