### config starts ### <br/>
<br/>
# USER - , . <br/>
# , , . <br/>
user nginx;<br/>
<br/>
# . <br/>
worker_processes 1 ;<br/>
<br/>
error_log /var/log/nginx/error.log;<br/>
<br/>
# , . <br/>
pid /var/run/nginx.pid;<br/>
# <br/>
events {<br/>
worker_connections 1024 ;<br/>
}<br/>
<br/>
http {<br/>
# include - . . <br/>
include /etc/nginx/mime.types;<br/>
default_type application/octet-stream;<br/>
<br/>
# <br/>
# configure log format <br/>
# log_format main '$remote_addr - $remote_user [$time_local] ' <br/>
# '"$request" $status $body_bytes_sent "$http_referer" ' <br/>
# '"$http_user_agent" "$http_x_forwarded_for"'; <br/>
# access_log /var/log/nginx/access.log main; <br/>
# <br/>
<br/>
# Linux FreeBSD 4.x. <br/>
# . <br/>
tcp_nopush on ;<br/>
# keep-alive. <br/>
# ( , ) <br/>
tcp_nodelay off ;<br/>
<br/>
sendfile on ; # sendfile(). <br/>
keepalive_timeout 65 ; # . <br/>
<br/>
# ngx_http_gzip_module - , gzip, 2 . <br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_gzip_module.html <br/>
gzip on ; # gzip. <br/>
gzip_proxied any; # . <br/>
# gzip MIME- "text/html". "text/html" ! <br/>
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; <br/>
gzip_http_version 1.1 ;<br/>
<br/>
# FastCGI-. <br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_fastcgi_module.html <br/>
fastcgi_connect_timeout 300 ;<br/>
fastcgi_send_timeout 300 ;<br/>
fastcgi_read_timeout 300 ;<br/>
# , , FastCGI-. <br/>
fastcgi_buffer_size 64k;<br/>
# , , FastCGI-. <br/>
fastcgi_buffers 4 64k;<br/>
<br/>
# fastcgi nodes <br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_upstream.html#upstream <br/>
# . <br/>
upstream backend {<br/>
server unix:/tmp/fcgi.sock; # unix <br/>
}<br/>
<br/>
# . <br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#server <br/>
server {<br/>
<br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#listen <br/>
# , . <br/>
listen 80 ; <br/>
<br/>
# . <br/>
# , , unix-. <br/>
# , . <br/>
server_name www.name.com; # <br/>
root /var/www/html; # . <br/>
autoindex off ; # , directory listing - off <br/>
<br/>
# URI, . <br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#error_page <br/>
error_page 404 error/404.html;<br/>
error_page 502 503 504 error/500.html;<br/>
# error_page 404 = @magento; <br/>
<br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#location <br/>
# URI . <br/>
# , ... <br/>
location ~ (/(app/|includes/|lib/|pkginfo/|var/|report/config.xml)|/\.svn/|/.hta.+)<br/>
{<br/>
deny all ; # ... <br/>
}<br/>
<br/>
# <br/>
location ~ (\.php|/downloader/?|/report/?)$ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
# FastCGI-. <br/>
fastcgi_pass backend;<br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_fastcgi_module.html <br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root$fastcgi_script_name;<br/>
}<br/>
<br/>
# <br/>
# <br/>
location = /downloader { rewrite ^ /downloader/ permanent; }<br/>
<br/>
# <br/>
location = /downloader/ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/downloader/index.php;<br/>
}<br/>
<br/>
location = /report { rewrite ^ /report/ permanent; }<br/>
<br/>
location = /report/ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/report/index.php;<br/>
}<br/>
<br/>
location / {<br/>
# set expire headers <br/>
if ($request_uri ~* " \. (ico|css|js|gif|jpe?g|png)$" ) {<br/>
expires max; # http://sysoev.ru/nginx/docs/http/ngx_http_headers_module.html#expires <br/>
}<br/>
# "@" location. <br/>
# location , <br/>
# . <br/>
try_files $uri $uri/ @magento;<br/>
index index.php;<br/>
expires max;<br/>
}<br/>
<br/>
# "@" ( ) <br/>
location @magento {<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/index.php;<br/>
}<br/>
} <br/>
<br/>
# HTTPS , , , . <br/>
# <br/>
server {<br/>
listen 443 ; # SSL port <br/>
server_name www.name.com;<br/>
root /var/www/html;<br/>
autoindex off ;<br/>
<br/>
# error_page 404 495 496 497 error/400.html; <br/>
# error_page 502 503 504 error/500.html; <br/>
<br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_ssl_module.html <br/>
ssl on ; # HTTPS . <br/>
ssl_protocols SSLv3 TLSv1; # . <br/>
ssl_ciphers HIGH:!ADH:!MD5; # . <br/>
# , SSLv3 TLSv1 , . <br/>
ssl_prefer_server_ciphers on ;<br/>
<br/>
# CA . <br/>
ssl_certificate /etc/nginx/cert/bundle.crt;<br/>
# . <br/>
ssl_certificate_key /etc/nginx/cert/myserver.key;<br/>
<br/>
# . <br/>
ssl_session_cache shared:SSL:10m;<br/>
# , , <br/>
ssl_session_timeout 10m;<br/>
<br/>
<br/>
keepalive_timeout 65 ;<br/>
<br/>
# http://sysoev.ru/nginx/docs/http/ngx_http_headers_module.html#add_header <br/>
add_header Front-End-Https on ;<br/>
<br/>
location ~ (/(app/|includes/|lib/|pkginfo/|var/|report/config.xml)|/\.svn/|/.hta.+)<br/>
{<br/>
deny all ;<br/>
}<br/>
<br/>
location ~ (\.php|/downloader/?|/report/?)$ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root$fastcgi_script_name;<br/>
fastcgi_param HTTPS on ; # ssl <br/>
}<br/>
<br/>
location = /downloader { rewrite ^ /downloader/ permanent; }<br/>
<br/>
location = /downloader/ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/downloader/index.php;<br/>
fastcgi_param HTTPS on ; # ssl <br/>
}<br/>
<br/>
location = /report { rewrite ^ /report/ permanent; }<br/>
<br/>
location = /report/ {<br/>
try_files /error/404.html $uri/ = 404 ;<br/>
<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/report/index.php;<br/>
fastcgi_param HTTPS on ; # ssl <br/>
}<br/>
<br/>
location / {<br/>
try_files $uri $uri/ @magento;<br/>
index index.php;<br/>
expires max;<br/>
}<br/>
<br/>
location @magento {<br/>
fastcgi_pass backend;<br/>
include /etc/nginx/fastcgi_params;<br/>
fastcgi_param script_FILENAME $document_root/index.php;<br/>
fastcgi_param HTTPS on ; # ssl <br/>
}<br/>
# phpmyadmin, https://www.mysite.com/phpmyadmin/ <br/>
location = /phpmyadmin { rewrite ^ /phpmyadmin/ permanent; }<br/>
}<br/>
<br/>
} <br/>
<br/>
<br/>
### config ends ### <br/>
<configuration> <section name = "global_options"> <value name = "pid_file"> / var / run / php-fpm.pid </ value> <value name = "error_log"> / var / log / php-fpm.log </ value> <value name = "log_level"> notice </ value> <value name = "emergency_restart_threshold"> 10 </ value> <value name = "emergency_restart_interval"> 1m </ value> <value name = "process_control_timeout"> 5s </ value> <value name = "daemonize"> yes </ value> </ section> <workers> <section name = "pool"> <value name = "name"> default </ value> <value name = "listen_address"> / tmp / fcgi.sock </ value> <value name = "listen_options"> <value name = "owner"> </ value> <value name = "group"> </ value> <value name = "mode"> 0666 </ value> </ value> <value name = "php_defines"> </ value> <value name = "user"> nginx </ value> <value name = "group"> nginx </ value> <value name = "pm"> <value name = "style"> static </ value> <value name = "max_children"> 10 </ value> <value name = "apache_like"> <value name = "StartServers"> 20 </ value> <value name = "MinSpareServers"> 5 </ value> <value name = "MaxSpareServers"> 35 </ value> </ value> </ value> <value name = "request_terminate_timeout"> 0s </ value> <value name = "request_slowlog_timeout"> 0s </ value> <value name = "slowlog"> logs / slow.log </ value> <value name = "rlimit_files"> 1024 </ value> <value name = "rlimit_core"> 0 </ value> <value name = "chroot"> </ value> <value name = "chdir"> </ value> <value name = "catch_workers_output"> yes </ value> <value name = "max_requests"> 500 </ value> <value name = "allowed_clients"> 127.0.0.1 </ value> <value name = "environment"> <value name = "HOSTNAME"> $ HOSTNAME </ value> <value name = "PATH"> / usr / local / bin: / usr / bin: / bin </ value> <value name = "TMP"> / tmp </ value> <value name = "TMPDIR"> / tmp </ value> <value name = "TEMP"> / tmp </ value> <value name = "OSTYPE"> $ OSTYPE </ value> <value name = "MACHTYPE"> $ MACHTYPE </ value> <value name = "MALLOC_CHECK _"> 2 </ value> </ value> </ section> </ workers> </ configuration> </ code>
Source: https://habr.com/ru/post/98306/
All Articles