Skip to content

Instantly share code, notes, and snippets.

@kapb14
Forked from dragolabs/nginx-bitrix.conf
Created April 26, 2017 09:53
Show Gist options
  • Save kapb14/de3546af04bec48e33791a886902c477 to your computer and use it in GitHub Desktop.
Save kapb14/de3546af04bec48e33791a886902c477 to your computer and use it in GitHub Desktop.
nginx configuration for bitrix cms
server {
listen 80;
server_name bitrix.example.com;
client_max_body_size 200m;
root /var/www/bitrix;
index index.html index.php;
access_log /var/log/nginx/bitrix.access.log;
error_log /var/log/nginx/bitrix.error.log;
location / {
try_files $uri $uri/ @bitrix;
}
location ~ ^/(.svn|.ht|bitrix/modules|upload/support/not_image|bitrix/php_interface) {
return 404;
}
location ~* ^/.*(jpg|jpeg|gif|png|psd|ico|css|html|swf|rar|zip|qz|7z|doc|xls|pdf|avi|mp3|js|docx|doc)$ {
log_not_found off;
access_log off;
expires max;
error_page 404 = /404.php;
}
location ~ \.php$ {
try_files $uri @bitrix;
include fastcgi_params;
fastcgi_pass 127.0.0.1:10001;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location @bitrix {
rewrite ^/detail/(.*[^/])$ /detail/$1/ permanent;
fastcgi_pass 127.0.0.1:10001;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root/bitrix/urlrewrite.php;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment