Skip to content

Instantly share code, notes, and snippets.

@fletchowns
Created August 13, 2014 06:22
Show Gist options
  • Save fletchowns/3a7507b1c834f520ed0a to your computer and use it in GitHub Desktop.
Save fletchowns/3a7507b1c834f520ed0a to your computer and use it in GitHub Desktop.
nginx config
server {
server_name mycoolsite.com;
listen 443 ssl spdy;
root /var/www/mycoolsite.com;
index index.html;
access_log /var/log/nginx/mycoolsite.com_access.log;
error_log /var/log/nginx/mycoolsite.com_error.log;
client_max_body_size 10m;
location /subsonic/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd-group;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_set_header Authorization $upstream_http_authorization;
proxy_max_temp_file_size 0;
proxy_pass http://localhost:58383/subsonic/;
proxy_redirect http:// https://;
}
location /RPC2 {
include scgi_params;
scgi_pass unix:/var/run/scgi.socket;
}
location /rtgui/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/htpasswd-admin;
root /var/www/rtgui/current;
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
# http://stackoverflow.com/questions/1011101/nginx-location-directive-doesnt-seem-to-be-working-am-i-missing-something
set $php_root $document_root;
if ($request_uri ~* /rtgui) {
set $php_root /var/www/rtgui/current;
}
fastcgi_pass unix:/var/run/php-fpm-www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* \.(js|css|gif)$ {
set $my_root $document_root;
if ($request_uri ~* /rtgui) {
set $my_root /var/www/rtgui/current;
}
root $my_root;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment