Bitrix nginx php fpm 404

битрикс + nginx + php-fpm

:)

мне увы пока так и не удалось полностью подружить эту связку.
столкнулся с проблемой заголовков(при ЧПУ), т.е. получаем либо на все 200 OK либо 404 Not Found

если интересно могу выложить конфиги.

совместными усилиями, собрали рабочий конфиг, спасибо Сергею Ляпко

UPD 23.12.2015: Добавил новый конфиг.

Старый

server < listen 80; server_name example.com www.example.com; server_name_in_redirect off; # access_log /var/log/nginx/example.com.nginx.access.log main; index index.php; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; root /var/www; #кому не надо убирать у домена www это не пишем. между http:// и example.com убрать пробел, парсер дурит :) if ($host = 'www.example.com' ) < rewrite ^(.*)$ http:// example.com$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrix < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; >location ^~ /bitrix/admin/ < try_files $uri @bitrixadm; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrixadm < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; >location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ < access_log off; expires max; error_page 404 = /404.html;#не забываем создать страницу >location ~ (/\.ht|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface) < deny all; >#все помнят это :) location ~ /.svn/ < deny all; >location ~ /\.ht < deny all; >>
server < listen 192.168.100.1:80; ssi on; gzip on; gzip_comp_level 7; gzip_types application/x-javascript application/javascript text/css; server_name test.ru www.test.ru; charset off; #disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /home/test/data/www/test.ru; set $php_sock unix:/var/run/php-fpm.test.sock; access_log /home/httpd-logs/test.ru.access.log ; error_log /home/httpd-logs/test.ru.error.log notice; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; #кому не надо убирать у домена www это не пишем. между http:// и test.ru убрать пробел, парсер дурит :) if ($host = 'www.test.ru' ) < rewrite ^(.*)$ http://test.ru$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~* /upload/.*\.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)$ < types < text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht py psp rb var; >> location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrix < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location ~* /bitrix/admin.+\.php$ < try_files $uri @bitrixadm; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrixadm < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; ># # block this locations for any installation # # ht(passwd|access) location ~* /\.ht < deny all; ># repositories location ~* /\.(svn|hg|git) < deny all; ># bitrix internal locations location ~* ^/bitrix/(modules|local_cache|stack_cache|managed_cache|php_interface) < deny all; ># upload files location ~* ^/upload/1c_[^/]+/ < deny all; ># use the file system to access files outside the site (cache) location ~* /\.\./ < deny all; >location ~* ^/bitrix/html_pages/\.config\.php < deny all; >location ~* ^/bitrix/html_pages/\.enabled < deny all; ># Intenal locations location ^~ /upload/support/not_image < internal; ># Cache location: composite and general site location ~* @.*\.html$ < internal; # disable browser cache, php manage file expires -1y; add_header X-Bitrix-Composite "Nginx (file)"; ># Player options, disable no-sniff location ~* ^/bitrix/components/bitrix/player/mediaplayer/player$ < add_header Access-Control-Allow-Origin *; ># Accept access for merged css and js location ~* ^/bitrix/cache/(css/.+\.css|js/.+\.js)$ < expires 30d; error_page 404 /404.html; ># Disable access for other assets in cache location location ~* ^/bitrix/cache < deny all; ># Use nginx to return static content from s3 cloud storage # /upload/bx_cloud_upload/...amazonaws.com/ location ^~ /upload/bx_cloud_upload/ < location ~ ^/upload/bx_cloud_upload/(http[s]?)\.([^/:]+)\.(s3|s3-us-west-1|s3-eu-west-1|s3-ap-southeast-1|s3-ap-northeast-1)\.amazonaws\.com/(.+)$ < internal; resolver 8.8.8.8; proxy_method GET; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Server $host; #proxy_max_temp_file_size 0; proxy_pass $1://$2.$3.amazonaws.com/$4; >location ~* .*$ < deny all; >> # Static content location ~* ^/(upload|bitrix/images|bitrix/tmp) < expires 30d; >location ~* \.(css|js|gif|png|jpg|jpeg|ico|ogg|ttf|woff|eot|otf)$ < error_page 404 /404.html; expires 30d; >location = /404.html < access_log off ; >>

Источник

Читайте также:  Ширина макета

битрикс + nginx + php-fpm

:)

мне увы пока так и не удалось полностью подружить эту связку.
столкнулся с проблемой заголовков(при ЧПУ), т.е. получаем либо на все 200 OK либо 404 Not Found

если интересно могу выложить конфиги.

совместными усилиями, собрали рабочий конфиг, спасибо Сергею Ляпко

UPD 23.12.2015: Добавил новый конфиг.

Старый

server < listen 80; server_name example.com www.example.com; server_name_in_redirect off; # access_log /var/log/nginx/example.com.nginx.access.log main; index index.php; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; root /var/www; #кому не надо убирать у домена www это не пишем. между http:// и example.com убрать пробел, парсер дурит :) if ($host = 'www.example.com' ) < rewrite ^(.*)$ http:// example.com$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrix < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; >location ^~ /bitrix/admin/ < try_files $uri @bitrixadm; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrixadm < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; >location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ < access_log off; expires max; error_page 404 = /404.html;#не забываем создать страницу >location ~ (/\.ht|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface) < deny all; >#все помнят это :) location ~ /.svn/ < deny all; >location ~ /\.ht < deny all; >>
server < listen 192.168.100.1:80; ssi on; gzip on; gzip_comp_level 7; gzip_types application/x-javascript application/javascript text/css; server_name test.ru www.test.ru; charset off; #disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /home/test/data/www/test.ru; set $php_sock unix:/var/run/php-fpm.test.sock; access_log /home/httpd-logs/test.ru.access.log ; error_log /home/httpd-logs/test.ru.error.log notice; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; #кому не надо убирать у домена www это не пишем. между http:// и test.ru убрать пробел, парсер дурит :) if ($host = 'www.test.ru' ) < rewrite ^(.*)$ http://test.ru$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~* /upload/.*\.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)$ < types < text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht py psp rb var; >> location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrix < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location ~* /bitrix/admin.+\.php$ < try_files $uri @bitrixadm; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrixadm < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; ># # block this locations for any installation # # ht(passwd|access) location ~* /\.ht < deny all; ># repositories location ~* /\.(svn|hg|git) < deny all; ># bitrix internal locations location ~* ^/bitrix/(modules|local_cache|stack_cache|managed_cache|php_interface) < deny all; ># upload files location ~* ^/upload/1c_[^/]+/ < deny all; ># use the file system to access files outside the site (cache) location ~* /\.\./ < deny all; >location ~* ^/bitrix/html_pages/\.config\.php < deny all; >location ~* ^/bitrix/html_pages/\.enabled < deny all; ># Intenal locations location ^~ /upload/support/not_image < internal; ># Cache location: composite and general site location ~* @.*\.html$ < internal; # disable browser cache, php manage file expires -1y; add_header X-Bitrix-Composite "Nginx (file)"; ># Player options, disable no-sniff location ~* ^/bitrix/components/bitrix/player/mediaplayer/player$ < add_header Access-Control-Allow-Origin *; ># Accept access for merged css and js location ~* ^/bitrix/cache/(css/.+\.css|js/.+\.js)$ < expires 30d; error_page 404 /404.html; ># Disable access for other assets in cache location location ~* ^/bitrix/cache < deny all; ># Use nginx to return static content from s3 cloud storage # /upload/bx_cloud_upload/...amazonaws.com/ location ^~ /upload/bx_cloud_upload/ < location ~ ^/upload/bx_cloud_upload/(http[s]?)\.([^/:]+)\.(s3|s3-us-west-1|s3-eu-west-1|s3-ap-southeast-1|s3-ap-northeast-1)\.amazonaws\.com/(.+)$ < internal; resolver 8.8.8.8; proxy_method GET; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Server $host; #proxy_max_temp_file_size 0; proxy_pass $1://$2.$3.amazonaws.com/$4; >location ~* .*$ < deny all; >> # Static content location ~* ^/(upload|bitrix/images|bitrix/tmp) < expires 30d; >location ~* \.(css|js|gif|png|jpg|jpeg|ico|ogg|ttf|woff|eot|otf)$ < error_page 404 /404.html; expires 30d; >location = /404.html < access_log off ; >>

Источник

битрикс + nginx + php-fpm

:)

мне увы пока так и не удалось полностью подружить эту связку.
столкнулся с проблемой заголовков(при ЧПУ), т.е. получаем либо на все 200 OK либо 404 Not Found

если интересно могу выложить конфиги.

совместными усилиями, собрали рабочий конфиг, спасибо Сергею Ляпко

UPD 23.12.2015: Добавил новый конфиг.

Старый

server < listen 80; server_name example.com www.example.com; server_name_in_redirect off; # access_log /var/log/nginx/example.com.nginx.access.log main; index index.php; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; root /var/www; #кому не надо убирать у домена www это не пишем. между http:// и example.com убрать пробел, парсер дурит :) if ($host = 'www.example.com' ) < rewrite ^(.*)$ http:// example.com$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrix < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; >location ^~ /bitrix/admin/ < try_files $uri @bitrixadm; fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; >location @bitrixadm < fastcgi_pass unix:/var/run/php5-fpm/www.sock; #путь до сокета php-fpm include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; >location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ < access_log off; expires max; error_page 404 = /404.html;#не забываем создать страницу >location ~ (/\.ht|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface) < deny all; >#все помнят это :) location ~ /.svn/ < deny all; >location ~ /\.ht < deny all; >>
server < listen 192.168.100.1:80; ssi on; gzip on; gzip_comp_level 7; gzip_types application/x-javascript application/javascript text/css; server_name test.ru www.test.ru; charset off; #disable_symlinks if_not_owner from=$root_path; index index.php; root $root_path; set $root_path /home/test/data/www/test.ru; set $php_sock unix:/var/run/php-fpm.test.sock; access_log /home/httpd-logs/test.ru.access.log ; error_log /home/httpd-logs/test.ru.error.log notice; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; client_max_body_size 1024M; client_body_buffer_size 4M; #кому не надо убирать у домена www это не пишем. между http:// и test.ru убрать пробел, парсер дурит :) if ($host = 'www.test.ru' ) < rewrite ^(.*)$ http://test.ru$1 permanent; >location / < try_files $uri $uri/ @bitrix; >location ~* /upload/.*\.(php|php3|php4|php5|php6|phtml|pl|asp|aspx|cgi|dll|exe|shtm|shtml|fcg|fcgi|fpl|asmx|pht|py|psp|rb|var)$ < types < text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht py psp rb var; >> location ~ \.php$ < try_files $uri @bitrix; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrix < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location ~* /bitrix/admin.+\.php$ < try_files $uri @bitrixadm; fastcgi_pass $php_sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; include fastcgi_params; >location @bitrixadm < fastcgi_pass $php_sock; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php; fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f wm@test.ru"; >location = /favicon.ico < log_not_found off; access_log off; >location = /robots.txt < allow all; log_not_found off; access_log off; ># # block this locations for any installation # # ht(passwd|access) location ~* /\.ht < deny all; ># repositories location ~* /\.(svn|hg|git) < deny all; ># bitrix internal locations location ~* ^/bitrix/(modules|local_cache|stack_cache|managed_cache|php_interface) < deny all; ># upload files location ~* ^/upload/1c_[^/]+/ < deny all; ># use the file system to access files outside the site (cache) location ~* /\.\./ < deny all; >location ~* ^/bitrix/html_pages/\.config\.php < deny all; >location ~* ^/bitrix/html_pages/\.enabled < deny all; ># Intenal locations location ^~ /upload/support/not_image < internal; ># Cache location: composite and general site location ~* @.*\.html$ < internal; # disable browser cache, php manage file expires -1y; add_header X-Bitrix-Composite "Nginx (file)"; ># Player options, disable no-sniff location ~* ^/bitrix/components/bitrix/player/mediaplayer/player$ < add_header Access-Control-Allow-Origin *; ># Accept access for merged css and js location ~* ^/bitrix/cache/(css/.+\.css|js/.+\.js)$ < expires 30d; error_page 404 /404.html; ># Disable access for other assets in cache location location ~* ^/bitrix/cache < deny all; ># Use nginx to return static content from s3 cloud storage # /upload/bx_cloud_upload/...amazonaws.com/ location ^~ /upload/bx_cloud_upload/ < location ~ ^/upload/bx_cloud_upload/(http[s]?)\.([^/:]+)\.(s3|s3-us-west-1|s3-eu-west-1|s3-ap-southeast-1|s3-ap-northeast-1)\.amazonaws\.com/(.+)$ < internal; resolver 8.8.8.8; proxy_method GET; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Server $host; #proxy_max_temp_file_size 0; proxy_pass $1://$2.$3.amazonaws.com/$4; >location ~* .*$ < deny all; >> # Static content location ~* ^/(upload|bitrix/images|bitrix/tmp) < expires 30d; >location ~* \.(css|js|gif|png|jpg|jpeg|ico|ogg|ttf|woff|eot|otf)$ < error_page 404 /404.html; expires 30d; >location = /404.html < access_log off ; >>

Поставил в таком варианте последнюю версию 12.5.11, не работает визуальный редактор.
Показывает панель без иконок расянутую в столбик.

Разобрался, эти два убрать.
location ^~ /bitrix/admin/
location @bitrixadmобработка ссылки /bitrix/admin/ на 404.php для есть в urlrewrite.php
Как есть отправляет .js и .css в php, а там access denied

fastcgi_param PHP_VALUE «mbstring.func_overload = 2»;
fastcgi_param PHP_VALUE «mbstring.internal_encoding = UTF-8»;

Если это не прописано в php.ini

Касательно части с /bitrix/admin
Также некорректно отдавались стили и скрипты для визуального редактора находящиеся в /bitrix/admin/htmleditor2/
вместо location ^~ /bitrix/admin/ установил такой конфиг:

В изначальном варианте js и css из этой директории nginx запрашивал у php-fpm, который ругался, отдавая на них Access denied и в логах — see security.limit_extensions

Как вариант, можно правила для статики перенести выше, но не проверял.

Рахимбердин Эльдар, этот location нужен для корректного отображения страницы 404 в административном разделе Битрикс.

без этого location не работает даже рабочий стол в административной панели 14 версии.

Топикстатеру и всем участвующим — респект и уважуха.

Кроме этого, в этом конфиге не учтены требования модуля проактивной защиты Битрикс. Вот что получилось у меня в итоге (используется php-fpm, nginx в ISPManager5):

server set $root_path /var/www/viss-spb/data/www/test.com;
set $php_sock unix:/var/www/php-fpm/test.sock;
listen x.x.x.x:80;
server_name test.local test.com;
access_log /var/www/httpd-logs/test.com.access.log ;
error_log /var/www/httpd-logs/test.com.error.log notice;
disable_symlinks if_not_owner from=$root_path;
server_name_in_redirect off;
index index.php;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
client_max_body_size 1024M;
client_body_buffer_size 4M;
root $root_path;
fastcgi_index index.php;
add_header X-Content-Type-Options nosniff;
location / try_files $uri $uri/ @bitrix;
>
location ~ ^/bitrix/modules deny all;
>
location ~ \.php$ try_files $uri @bitrix;
fastcgi_pass $php_sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
>
location @bitrix fastcgi_pass $php_sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
>
location ~* /bitrix/admin.+\.php$ try_files $uri @bitrixadm;
fastcgi_pass $php_sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
>
location ^~ /upload/ if (!-e $request_filename) rewrite ^(.+)$ /index.php last;
>
types text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht;
>
>
location @bitrixadm fastcgi_pass unix:/var/www/php-fpm/test.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php;
>
location = /favicon.ico log_not_found off;
access_log off;
>
location = /robots.txt allow all;
log_not_found off;
access_log off;
>
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ access_log off;
expires max;
error_page 404 = /404.html;
>
location ~ (/\.ht|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface) deny all;
>
location ~ /.svn/ deny all;
>
location ~ /\.ht deny all;
>
>

Добрый день. Столкнулся с проблемой отображения картинок в IE и Опере. Nginx настроил с помощью этой темы, огромное спасибо всем. Но третий день бьюсь над проблемой не могу решить ее пока, может быть что то подскажете. Суть проблемы не отображаются картинки лежащие глубже чем корень сайта.
Сделал вот такой скрипт для наглядного отображения проблемы
http://esz.kz/test.php

server set $root_path /home/eszkz/www;
set $php_sock unix:/var/run/php5-fpm.sock;
listen 80;
server_name esz.kz;
access_log /home/eszkz/logs/access.log ;
error_log /home/eszkz/logs/error.log notice;
disable_symlinks if_not_owner from=$root_path;
server_name_in_redirect off;
index index.php index.html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
client_max_body_size 1024M;
client_body_buffer_size 4M;
root $root_path;
fastcgi_index index.php;
add_header X-Content-Type-Options nosniff;
location / try_files $uri $uri/ @bitrix;
>
location ~ ^/bitrix/modules deny all;
>
location ~ \.php$ try_files $uri @bitrix;
fastcgi_pass $php_sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
>
location @bitrix fastcgi_pass $php_sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
>
location ~* /bitrix/admin.+\.php$ try_files $uri @bitrixadm;
fastcgi_pass $php_sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
>
location ^~ /upload/ if (!-e $request_filename) rewrite ^(.+)$ /index.php last;
>
types text/plain text/plain php php3 php4 php5 php6 phtml pl asp aspx cgi dll exe ico shtm shtml fcg fcgi fpl asmx pht;
>
>
location @bitrixadmfastcgi_pass unix:/var/www/php-fpm/esz.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/admin/404.php;
>
location = /favicon.ico log_not_found off;
access_log off;
>
location = /robots.txt allow all;
log_not_found off;
access_log off;
>
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ access_log off;
expires max;
error_page 404 = /404.html;
>
location ~ (/\.ht|/bitrix/modules|/upload/support/not_image|/bitrix/php_interface) deny all;
>
location ~ /.svn/ deny all;
>
location ~ /\.ht deny all;
>
>

Источник

Оцените статью