documentation/site/Apache2-Reverse-Proxy/index.html

690 lines
19 KiB
HTML

<!doctype html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="The official Invidious documentation">
<meta name="author" content="The Invidious project.">
<link rel="canonical" href="https://docs.invidious.io/Apache2-Reverse-Proxy/">
<link rel="icon" href="../images/favicon.ico">
<meta name="generator" content="mkdocs-1.2.3, mkdocs-material-8.2.5">
<title>Apache2-Reverse-Proxy - Invidious Documentation</title>
<link rel="stylesheet" href="../assets/stylesheets/main.2d9f7617.min.css">
<link rel="stylesheet" href="../assets/stylesheets/palette.e6a45f82.min.css">
<meta name="theme-color" content="#000000">
<script>__md_scope=new URL("..",location),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="" data-md-color-primary="black" data-md-color-accent="">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
</div>
<div data-md-component="announce">
</div>
<header class="md-header" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="Header">
<a href=".." title="Invidious Documentation" class="md-header__button md-logo" aria-label="Invidious Documentation" data-md-component="logo">
<img src="../images/invidious.png" alt="logo">
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Invidious Documentation
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Apache2-Reverse-Proxy
</span>
</div>
</div>
</div>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Search" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5z"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</label>
<nav class="md-search__options" aria-label="Search">
<button type="reset" class="md-search__icon md-icon" aria-label="Clear" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initializing search
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href=".." title="Invidious Documentation" class="md-nav__button md-logo" aria-label="Invidious Documentation" data-md-component="logo">
<img src="../images/invidious.png" alt="logo">
</a>
Invidious Documentation
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href=".." class="md-nav__link">
HOME
</a>
</li>
<li class="md-nav__item">
<a href="../API/" class="md-nav__link">
API
</a>
</li>
<li class="md-nav__item">
<a href="../Always-use-%22local%22-to-proxy-video-through-the-server-without-creating-an-account/" class="md-nav__link">
Always-use-"local"-to-proxy-video-through-the-server-without-creating-an-account
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" data-md-toggle="toc" type="checkbox" id="__toc">
<a href="./" class="md-nav__link md-nav__link--active">
Apache2-Reverse-Proxy
</a>
</li>
<li class="md-nav__item">
<a href="../Apache2-reverse-proxy/" class="md-nav__link">
Apache2-reverse-proxy
</a>
</li>
<li class="md-nav__item">
<a href="../Authenticated-Endpoints/" class="md-nav__link">
Authenticated-Endpoints
</a>
</li>
<li class="md-nav__item">
<a href="../Configuration/" class="md-nav__link">
Configuration
</a>
</li>
<li class="md-nav__item">
<a href="../Database-Information-and-Maintenance/" class="md-nav__link">
Database-Information-and-Maintenance
</a>
</li>
<li class="md-nav__item">
<a href="../Export-YouTube-subscriptions/" class="md-nav__link">
Export-YouTube-subscriptions
</a>
</li>
<li class="md-nav__item">
<a href="../Extensions/" class="md-nav__link">
Extensions
</a>
</li>
<li class="md-nav__item">
<a href="../FAQ/" class="md-nav__link">
Frequently Asked Questions
</a>
</li>
<li class="md-nav__item">
<a href="../Geoblocking%2C-available-video-quality-and-DASH/" class="md-nav__link">
Geoblocking,-available-video-quality-and-DASH
</a>
</li>
<li class="md-nav__item">
<a href="../How-to-deal-with-uMatrix/" class="md-nav__link">
How-to-deal-with-uMatrix
</a>
</li>
<li class="md-nav__item">
<a href="../How-to-setup-Anti-Captcha/" class="md-nav__link">
How-to-setup-Anti-Captcha
</a>
</li>
<li class="md-nav__item">
<a href="../Installation/" class="md-nav__link">
Installation
</a>
</li>
<li class="md-nav__item">
<a href="../Invidious-Instances/" class="md-nav__link">
Invidious-Instances
</a>
</li>
<li class="md-nav__item">
<a href="../Issues-with-CAPTCHA-on-Debian-and-Ubuntu/" class="md-nav__link">
Issues-with-CAPTCHA-on-Debian-and-Ubuntu
</a>
</li>
<li class="md-nav__item">
<a href="../Known-Exception-in-log/" class="md-nav__link">
Known-Exception-in-log
</a>
</li>
<li class="md-nav__item">
<a href="../List-of-URL-parameters/" class="md-nav__link">
List-of-URL-parameters
</a>
</li>
<li class="md-nav__item">
<a href="../NGINX-Reverse-Proxy/" class="md-nav__link">
NGINX-Reverse-Proxy
</a>
</li>
<li class="md-nav__item">
<a href="../Preferences/" class="md-nav__link">
Preferences
</a>
</li>
<li class="md-nav__item">
<a href="../Search-operators/" class="md-nav__link">
Search-operators
</a>
</li>
<li class="md-nav__item">
<a href="../Takedowns/" class="md-nav__link">
DMCA
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1>Apache2-Reverse-Proxy</h1>
<ul>
<li>A very basic config, secured with Let's Encrypt. Any log is disabled by default. Do not forget to replace <code>ServerName</code> with your domain.</li>
</ul>
<pre><code>&lt;IfModule mod_ssl.c&gt;
&lt;VirtualHost *:443&gt;
ServerName invidious.domain.tld
ServerAdmin admin@localhost
ProxyPreserveHost On
ProxyRequests off
ProxyPass / http://127.0.0.1:3000/
ProxyPassReverse / http://127.0.0.1:3000/
# ErrorLog /var/log/apache2/invidious.domain.tld/error.log
CustomLog /dev/null combined
RewriteEngine on
SSLCertificateFile /etc/letsencrypt/live/invidious.domain.tld/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/invidious.domain.tld/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/invidious.domain.tld/chain.pem
&lt;/VirtualHost&gt;
&lt;/IfModule&gt;
</code></pre>
<ul>
<li>Another config example without HTTPS, but with Apache Basic Auth HTTP login.
The user will connect to Apache on port 3333 and will be asked to log in. If authentification is successful, Apache will redirect the user to Invidious' page.
To make the VirtualHost config below actually work, you should as well:<ul>
<li>Create a <a href="http://httpd.apache.org/docs/current/programs/htpasswd.html">.htpasswd</a> file and add required <a href="http://aspirine.org/htpasswd_en.html">username/login combos</a> to it, if not already existing.</li>
<li>Open port 3333 (or any other free port) adding <code>Listen 3333</code> to Apache <code>ports.conf</code> (Debian <code>/etc/apache2/ports.conf</code>)</li>
<li>If you run Invidious with default parameters, you may need to replace default host binding (0.0.0.0) with localhost (127.0.0.1) instead. That way, Invidious won't be publicly available on port 3000 anymore, but only accessible via the reverse proxy on port 3333. So if you run Invidious via a systemd service, you would edit the service file (e.g. <code>/etc/systemd/system/invidious.service</code>) and modify the ExecStart line to include the -b switch as follows <code>ExecStart=/home/invidious/invidious/invidious -b 127.0.0.1 -o invidious.log</code> and then reload the daemon with <code>systemctl daemon-reload</code> so that changes are taken into account.</li>
<li>A convenient way to open such protected Invidious page without having to log in manually everytime is to access use a URL with the following format: <a href="http://username:password@domain:3333">http://username:password@domain:3333</a></li>
</ul>
</li>
</ul>
<pre><code>&lt;VirtualHost *:3333&gt;
ServerName invidious.domain.tld #add your own domain name (or localhost if you have none)
ServerAdmin admin@localhost
&lt;Location /&gt;
Deny from all # Forbid access to all by default...
#Allow from 127.0.0.1 #...Except from specific IPs (which will not need to authenticate)...
AuthUserFile /etc/apache2/.htpasswd #path to .htpasswd file
AuthName &quot;Restricted Area&quot; # name displayed in the promptbox
AuthType Basic # http://httpd.apache.org/docs/current/howto/auth.html
Satisfy Any
Require valid-user # ...and except from authenticated users included in the .htpasswd file
&lt;/Location&gt;
ProxyPass / http://127.0.0.1:3000/ nocanon
ProxyPassReverse / http://127.0.0.1:3000/
ProxyPreserveHost On
ProxyRequests Off
AllowEncodedSlashes On
#ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog /dev/null combined
&lt;/VirtualHost&gt;
</code></pre>
</article>
</div>
</div>
<a href="#" class="md-top md-icon" data-md-component="top" data-md-state="hidden">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg>
Back to top
</a>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Footer">
<a href="../Always-use-%22local%22-to-proxy-video-through-the-server-without-creating-an-account/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Always-use-&#34;local&#34;-to-proxy-video-through-the-server-without-creating-an-account" rel="prev">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11h12z"/></svg>
</div>
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Previous
</span>
Always-use-"local"-to-proxy-video-through-the-server-without-creating-an-account
</div>
</div>
</a>
<a href="../Apache2-reverse-proxy/" class="md-footer__link md-footer__link--next" aria-label="Next: Apache2-reverse-proxy" rel="next">
<div class="md-footer__title">
<div class="md-ellipsis">
<span class="md-footer__direction">
Next
</span>
Apache2-reverse-proxy
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11H4z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
<div class="md-social">
<a href="https://github.com/iv-org/documentation" target="_blank" rel="noopener" title="github.com" class="md-social__link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.0.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc.--><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg>
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "..", "features": ["navigation.tracking", "navigation.expand", "navigation.top"], "translations": {"clipboard.copy": "Copy to clipboard", "clipboard.copied": "Copied to clipboard", "search.config.lang": "en", "search.config.pipeline": "trimmer, stopWordFilter", "search.config.separator": "[\\s\\-]+", "search.placeholder": "Search", "search.result.placeholder": "Type to start searching", "search.result.none": "No matching documents", "search.result.one": "1 matching document", "search.result.other": "# matching documents", "search.result.more.one": "1 more on this page", "search.result.more.other": "# more on this page", "search.result.term.missing": "Missing", "select.version.title": "Select version"}, "search": "../assets/javascripts/workers/search.bd0b6b67.min.js"}</script>
<script src="../assets/javascripts/bundle.467223ff.min.js"></script>
</body>
</html>