メインコンテンツへスキップ

NGINX

NGINXは、無料のLet's Encrypt証明書を使用したリバースプロキシとして使用される人気のあるウェブサーバーです。 詳細な手順については、公式ドキュメントを参照してください。

Webソケット

人々はしばしば、NGINXにWebソケットを正しくプロキシする必要があることを見落とし、チャットが無効になることがあります。 適切に行うためには、nginxによるWebソケットサポートのクイックドキュメントをお読みください。

基本的には、/etc/nginx/nginx.confを編集して、httpセクションに次のマップブロックを追加する必要があります

http {
...
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
...
}

NGINXの設定が完了すると、次のような構成になるはずです。 次の内容を/etc/nginx/sites-available/my.site.com.confに追加し、ln /etc/nginx/sites-available/my.site.com.conf /etc/nginx/sites-enabled/my.site.com.confで有効にし、sudo nginx -tでテストし、sudo service nginx restartで再起動します

server {
server_name owncast.yourdomain.com;
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

location / {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Authorization $http_authorization;
proxy_pass_header Authorization;
proxy_pass http://127.0.0.1:8080;
}
}

Improve this page

See something missing or incorrect? Edit this page and improve the documentation for everyone.

Contributors to this documentation