Skip to content

Instantly share code, notes, and snippets.

@amusarra
Created March 9, 2014 21:33
Show Gist options
  • Save amusarra/9455020 to your computer and use it in GitHub Desktop.
Save amusarra/9455020 to your computer and use it in GitHub Desktop.
SugarCRM 7.1 NGINX Config File
server {
listen 8090;
server_name sugarcrmdev-71.dontesta.local;
#charset koi8-r;
access_log /var/log/nginx/sugarcrmdev-71.dontesta.local.access.log main;
error_log /var/log/nginx/sugarcrmdev-71.dontesta.local.error.log;
root /home/sugarcrm/application;
index index.php index.html;
location /instance_amusarra/ {
if (!-d $request_filename){
set $rule_0 true;
}
if (!-f $request_filename){
set $rule_0 true;
}
if ($rule_0){
rewrite ^/instance_amusarra/rest/(.*)$ /instance_amusarra/api/rest.php?__sugar_url=$1 last;
rewrite ^/instance_amusarra/cache/api/metadata/lang_(.._..)_(.*)_public\.json$ /instance_amusarra/rest/v10/lang/public/$1?platform=$2 last;
rewrite ^/instance_amusarra/cache/api/metadata/lang_(.._..)_([^_]*)\.json$ /instance_amusarra/rest/v10/lang/$1?platform=$2 last;
rewrite ^/instance_amusarra/portal/(.*)$ /instance_amusarra/portal2/$1 last;
rewrite ^/instance_amusarra/portal$ /instance_amusarra/portal/? permanent;
}
try_files $uri $uri/ index.php;
}
location /instance_shirus/ {
if (!-d $request_filename){
set $rule_0 true;
}
if (!-f $request_filename){
set $rule_0 true;
}
if ($rule_0){
rewrite ^/instance_shirus/rest/(.*)$ /instance_shirus/api/rest.php?__sugar_url=$1 last;
rewrite ^/instance_shirus/cache/api/metadata/lang_(.._..)_(.*)_public\.json$ /instance_shirus/rest/v10/lang/public/$1?platform=$2 last;
rewrite ^/instance_shirus/cache/api/metadata/lang_(.._..)_([^_]*)\.json$ /instance_shirus/rest/v10/lang/$1?platform=$2 last;
rewrite ^/instance_shirus/portal/(.*)$ /instance_shirus/portal2/$1 last;
rewrite ^/instance_shirus/portal$ /instance_shirus/portal/? permanent;
}
try_files $uri $uri/ index.php;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root /home/sugarcrm/application;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment