Skip to content

Instantly share code, notes, and snippets.

@truetamtam
Last active August 29, 2015 14:24
Show Gist options
  • Select an option

  • Save truetamtam/387bfb8f67c950b0f5df to your computer and use it in GitHub Desktop.

Select an option

Save truetamtam/387bfb8f67c950b0f5df to your computer and use it in GitHub Desktop.
[nginx + php-fpm] nginx config for webasyst shop-script6 installation.
server {
listen 80;
server_name wbs;
root /var/www/wbs;
index index.php;
if ($request_uri ~* "^(.*/)index\.php$") {
return 301 $1;
}
location ~ \.php$ {
# try_files $uri =404;
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
include fastcgi_params;
}
try_files $uri $uri/ /index.php?$query_string;
# location / {
# include /etc/nginx/fastcgi_params;
# fastcgi_pass unix:/var/run/php5-fpm.sock;
#index index.php;
# try_files $uri $uri/ /index.php?$query_string;
# }
# for install only
location /install.php {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location /api.php {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
location ^~ /wa-data/protected/ {
#return 403;
#X-Accel-Redirect
internal;
}
location ~* ^/wa-(log|config|cache|system)/ {
return 403;
}
location ~* ^/wa-data/public/contacts/photo/[0-9]+/ {
root /var/www/wbs;
access_log off;
expires 30d;
error_page 404 = @contacts_thumb;
}
location @contacts_thumb {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME /wa-data/public/contacts/photos/thumb.php;
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/contacts/photos/thumb.php;
}
# photos app
location ~* ^/wa-data/public/photos/[0-9]+/ {
access_log off;
expires 30d;
error_page 404 = @photos_thumb;
}
location @photos_thumb {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME /wa-data/public/photos/thumb.php;
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/photos/thumb.php;
}
# end photos app
# shop app
location ~* ^/wa-data/public/shop/products/[0-9]+/ {
access_log off;
expires 30d;
error_page 404 = @shop_thumb;
}
location @shop_thumb {
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_NAME /wa-data/public/shop/products/thumb.php;
fastcgi_param SCRIPT_FILENAME $document_root/wa-data/public/shop/products/thumb.php;
}
# end shop app
location ~* ^.+\.(jpg|jpeg|gif|png|js|css)$ {
access_log off;
expires 30d;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment