Skip to content

Instantly share code, notes, and snippets.

@fossxplorer
Created June 26, 2017 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fossxplorer/943ed638518987ae21e074a68c3d9258 to your computer and use it in GitHub Desktop.
Save fossxplorer/943ed638518987ae21e074a68c3d9258 to your computer and use it in GitHub Desktop.
Nginx Blesta config
server {
listen 192.168.0.30:80;
#keepalive_timeout 70;
server_name blesta.domain.com www.blesta.domain.com;
access_log /var/log/nginx/blesta.domain.com_access_log main buffer=16k;
error_log /var/log/nginx/blesta.domain.com_error_log;
root /var/www/vhosts/blesta/blesta;
index index.html index.php;
fastcgi_intercept_errors on;
error_page 404 /core/templates/404.php;
error_page 403 /core/templates/403.php;
set $fpmsock /var/run/php-fpm/blesta.sock;
location / {
rewrite ^/modules/gateways/callback/paypal.php$ blesta.domain.com/callback/gw/1/paypal_payments_standard/;
# try_files $uri $uri/ $uri.php; error_page 404 = @blesta; #IF file doesn't exist log_not_found off;
# For access to install file if ($request_uri ~ "^(.*)/install.php$"){
rewrite install.php /%1/install/ redirect;
expires 0;
add_header Cache-Control private;
}
}
#Core rewrite
location @blesta {
rewrite ^(.*)$ /index.php last;
}
#enable php
location ~ \.php$ {
# include /etc/nginx/nbs.rules;
fastcgi_buffers 256 16k; # 4096k total
fastcgi_max_temp_file_size 0; # will disable buffering to disk if replies start to exceeed your fastcgi buffers.
# fastcgi_param MOD_X_ACCEL_REDIRECT_ENABLED on;
set $nocache "";
fastcgi_split_path_info ^(.+\.php)(/.*)$;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_pass unix:/tmp/blesta.sock;
fastcgi_pass unix:$fpmsock;
include fastcgi_params; # IMPORTANT: import fastcgi_params
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; ### this is read from fastcgi_params
fastcgi_read_timeout 60m;
fastcgi_pass_header Set-Cookie;
fastcgi_cache_use_stale error timeout invalid_header http_500;
fastcgi_cache_key host$request_uri;
fastcgi_cache blesta;
fastcgi_cache_valid 200 1m;
fastcgi_cache_bypass $nocache;
fastcgi_no_cache $nocache;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment