Skip to content

Instantly share code, notes, and snippets.

@nadavkav
Created December 26, 2016 20:08
Show Gist options
  • Save nadavkav/56f227572afd0c82d06425a79151886c to your computer and use it in GitHub Desktop.
Save nadavkav/56f227572afd0c82d06425a79151886c to your computer and use it in GitHub Desktop.
# usr/local/nginx/conf/nginx.conf
#user nobody;
# do not use user root like I did!
user root;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
# consider using HTTPS 443, as kaltura streaming vod supports it.
listen 80;
server_name your-institute.ac.il;
#charset koi8-r;
#access_log logs/your-institute.ac.il_access.log main;
access_log logs/your-institute.ac.il_vod_access.log;
error_log logs/your-institute.ac.il_vod_error.log error;
location / {
root html;
index index.php index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
# Hide PHP errors?
#error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# CentOS 7.x - Install php-fpm for nginx from ius.org
# 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 html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# PHP Configs
fastcgi_intercept_errors on;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# Mitigate https://httpoxy.org/ vulnerabilities
#fastcgi_param HTTP_PROXY "";
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
location /server-status {
stub_status;
access_log off;
allow your.ip.add.ress;
deny all;
}
####################################
#
# VOD
#
# vod settings
vod_mode local;
#vod_fallback_upstream_location /fallback;
vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
vod_last_modified_types *;
# vod caches
vod_metadata_cache metadata_cache 512m;
vod_response_cache response_cache 128m;
# gzip manifests
gzip on;
gzip_types application/vnd.apple.mpegurl;
# file handle caching / aio
open_file_cache max=1000 inactive=5m;
open_file_cache_valid 2m;
open_file_cache_min_uses 1;
open_file_cache_errors on;
aio on;
# MP4 video folders, that are going to be served as MPEG-DASH
# https://github.com/kaltura/nginx-vod-module#filename-structure
# http://your-institute.ac.il/vod/music.mp4/manifest
location /vod/ {
# Manage it with wordpress
#location ^/(vod|wordpress/wp-content/uploads)/ {
#root /usr/local/nginx/html/video/;
#root vod/;
vod dash;
vod_segment_duration 4000;
vod_bootstrap_segment_durations 3500;
vod_align_segments_to_key_frames on;
vod_dash_manifest_format segmenttemplate;
add_header Last-Modified "Sun, 19 Nov 2000 08:52:00 GMT";
add_header Access-Control-Allow-Headers "origin,range,accept-encoding,referer";
add_header Access-Control-Expose-Headers "Server,range,Content-Length,Content-Range";
add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS";
add_header Access-Control-Allow-Origin "*";
expires 100d;
}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment