Created
January 11, 2020 12:42
-
-
Save uupaa/d8d91970260926ed177c48dbe55bdd46 to your computer and use it in GitHub Desktop.
ngconf at 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#user nobody; | |
#user nginx; | |
worker_processes 2; | |
# 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"'; | |
log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time'; | |
access_log logs/access.log main; | |
sendfile on; | |
#tcp_nopush on; | |
#keepalive_timeout 0; | |
keepalive_timeout 65; | |
#gzip on; | |
#upstream any_websocket { | |
# ip_hash; | |
# server 127.0.0.1:8000; | |
#} | |
server { | |
listen 80; | |
server_name localhost; | |
autoindex on; | |
charset UTF-8; | |
client_max_body_size 20M; | |
access_log logs/host.access.log main; | |
listen 443 ssl http2; | |
ssl_prefer_server_ciphers on; | |
ssl_ciphers AESGCM:HIGH:!aNULL:!MD5; | |
ssl_certificate /usr/local/etc/nginx/server.crt; | |
ssl_certificate_key /usr/local/etc/nginx/server.key; | |
ssl_session_cache shared:ssl_session_cache:10m; | |
location / { | |
root /usr/local/var/www; | |
index index.html index.htm; | |
if ($http_origin ~* (https://(www\.example\.com|ope\.example\.com|localhost))) { # | |
set $cors "true"; | |
} | |
if ($cors = "true") { | |
add_header Access-Control-Allow-Origin $http_origin always; | |
add_header Access-Control-Allow-Methods "POST, GET, OPTIONS"; | |
add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
add_header Access-Control-Allow-Credentials true; | |
} | |
} | |
## this settings for knives-out 20180623 | |
location /assets/ { | |
# 末尾に assets/ をつけない! | |
# eg: root /usr/local/var/www/App/; | |
root /usr/local/var/www/App/; | |
} | |
# location /sd/ { | |
# proxy_http_version 1.1; | |
# proxy_pass http://localhost:8888/; | |
# add_header Access-Control-Allow-Origin *; | |
# add_header Access-Control-Allow-Methods "POST, GET, OPTIONS"; | |
# add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
# add_header Access-Control-Allow-Credentials true; | |
# proxy_force_ranges on; # https://gist.github.com/uupaa/ad00a1912b5770b0023d | |
# # 以下のヘッダを差し替えたり差し込んだりすると | |
# # reject される設定になっているケース(アクセス元のアドレスをしっかり見て制限しているとか)もあるので | |
# # やってみてダメならコメントアウトする | |
# proxy_set_header X-Real-IP $remote_addr; | |
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# proxy_set_header Host $http_host; | |
# proxy_set_header X-NginX-Proxy true; | |
# } | |
#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 html; | |
} | |
# --- nginx: Avoid CORS and reverse proxy settings --- | |
# location /hls/ { | |
# proxy_http_version 1.1; | |
# proxy_pass http://localhost:8888/; | |
# | |
# add_header Access-Control-Allow-Origin *; | |
# add_header Access-Control-Allow-Methods "POST, GET, OPTIONS"; | |
# add_header Access-Control-Allow-Headers "Origin, Authorization, Accept"; | |
# add_header Access-Control-Allow-Credentials true; | |
# | |
# proxy_force_ranges on; # https://gist.github.com/uupaa/ad00a1912b5770b0023d | |
# | |
# # 以下のヘッダを差し替えたり差し込んだりすると | |
# # reject される設定になっているケース(アクセス元のアドレスをしっかり見て制限しているとか)もあるので | |
# # やってみてダメならコメントアウトする | |
# proxy_set_header X-Real-IP $remote_addr; | |
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
# proxy_set_header Host $http_host; | |
# proxy_set_header X-NginX-Proxy true; | |
# } | |
} | |
} | |
## for OBS->RTMP->HLS convert process | |
## | |
## OBS setting | |
## 配信URL: rtmp://127.0.0.1:1935/live (rtmp://localhost:1935/live だとだめ) | |
## CustomStreamKey: 適当(liveとか) | |
# rtmp_auto_push on; | |
# rtmp { | |
# server { | |
# listen 1935; | |
# chunk_size 1024; | |
# | |
# application live { | |
# live on; | |
# hls on; | |
# hls_path /Users/YOUE-USER-NAME/wip/live; | |
# hls_fragment 1s; | |
# hls_playlist_length 20s; | |
# hls_type live; | |
# wait_video on; | |
# } | |
# } | |
# } | |
include servers/*; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment