diff --git a/changes/changelog.d/apache.enhancement b/changes/changelog.d/apache.enhancement new file mode 100644 index 0000000000000000000000000000000000000000..5aa4338051fc5b4ca7b6d4f1080b5ebcb8ba8461 --- /dev/null +++ b/changes/changelog.d/apache.enhancement @@ -0,0 +1 @@ +Sample virtual-host file for Apache2 reverse-proxy (!165) diff --git a/deploy/apache.conf b/deploy/apache.conf index 75618e350b117dbe97f4ced2768e4b11d3a81958..8d5a5e1f7ee45c7a02f4f8654309744f841751c7 100644 --- a/deploy/apache.conf +++ b/deploy/apache.conf @@ -1,14 +1,18 @@ -# Following variables should be modified according to your setup -Define funkwhale-api http://192.168.1.199:5000 -Define funkwhale-api-ws ws://192.168.1.199:5000 -Define funkwhale-sn funkwhale.duckdns.org -Define MUSIC_DIRECTORY_PATH /music/directory/path +# Following variables MUST be modified according to your setup +Define funkwhale-sn funkwhale.yourdomain.com + +# Following variables should be modified according to your setup and if you +# use different configuration than what is described in our installation guide. +Define funkwhale-api http://localhost:5000 +Define MUSIC_DIRECTORY_PATH /srv/funkwhale/data/music +# websockets are not working yet +# Define funkwhale-api-ws ws://localhost:5000 # HTTP request redirected to HTTPS <VirtualHost *:80> ServerName ${funkwhale-sn} - + # Default is to force https RewriteEngine on RewriteCond %{SERVER_NAME} =${funkwhale-sn} @@ -26,7 +30,7 @@ Define MUSIC_DIRECTORY_PATH /music/directory/path <VirtualHost *:443> ServerName ${funkwhale-sn} - # Path to ErrorLog and access log + # Path to ErrorLog and access log ErrorLog ${APACHE_LOG_DIR}/funkwhale/error.log CustomLog ${APACHE_LOG_DIR}/funkwhale/access.log combined @@ -56,26 +60,21 @@ Define MUSIC_DIRECTORY_PATH /music/directory/path </IfModule> # Turning ProxyRequests on and allowing proxying from all may allow - # spammers to use your proxy to send email. + # spammers to use your proxy to send email. ProxyRequests Off - - <Proxy *> + + <Proxy *> AddDefaultCharset off Order Allow,Deny Allow from all - # Here you can set a password using htpasswd to protect your proxy server - #Authtype Basic - #Authname "Password Required" - #AuthUserFile /etc/apache2/.htpasswd - #Require valid-user </Proxy> # Activating WebSockets (not working) - ProxyPass "/api/v1/instance/activity" "ws://192.168.1.199:5000/api/v1/instance/activity" + # ProxyPass "/api/v1/instance/activity" "ws://localhost:5000/api/v1/instance/activity" <Location "/api"> # similar to nginx 'client_max_body_size 30M;' - LimitRequestBody 31457280 + LimitRequestBody 31457280 ProxyPass ${funkwhale-api}/api ProxyPassReverse ${funkwhale-api}/api @@ -84,7 +83,7 @@ Define MUSIC_DIRECTORY_PATH /music/directory/path ProxyPass ${funkwhale-api}/federation ProxyPassReverse ${funkwhale-api}/federation </Location> - + <Location "/.well-known/webfinger"> ProxyPass ${funkwhale-api}/.well-known/webfinger ProxyPassReverse ${funkwhale-api}/.well-known/webfinger @@ -95,9 +94,9 @@ Define MUSIC_DIRECTORY_PATH /music/directory/path Alias /staticfiles /srv/funkwhale/data/static # Setting appropriate access levels to serve frontend - <Directory "/srv/funkwhale/data/static"> + <Directory "/srv/funkwhale/data/static"> Options FollowSymLinks - AllowOverride None + AllowOverride None Require all granted </Directory> @@ -114,7 +113,7 @@ Define MUSIC_DIRECTORY_PATH /music/directory/path #LoadModule xsendfile_module modules/mod_xsendfile.so <IfModule mod_xsendfile.c> XSendFile On - XSendFilePath /srv/funkwhale/data/media + XSendFilePath /srv/funkwhale/data/media XSendFilePath ${MUSIC_DIRECTORY_PATH} SetEnv MOD_X_SENDFILE_ENABLED 1 </IfModule> diff --git a/docs/installation/index.rst b/docs/installation/index.rst index c2a70421bb15a0aadb4e55d64447830190c62ed7..5e4e320816a40725a05e1466cff6245bc34e6e8d 100644 --- a/docs/installation/index.rst +++ b/docs/installation/index.rst @@ -86,7 +86,7 @@ Files for the web frontend are purely static and can simply be downloaded, unzip Reverse proxy -------------- -In order to make funkwhale accessible from outside your server and to play nicely with other applications on your machine, you should configure a reverse proxy. At the moment, we only have documentation for nginx, if you know how to implement the same thing for apache, you're welcome. +In order to make funkwhale accessible from outside your server and to play nicely with other applications on your machine, you should configure a reverse proxy. Nginx ^^^^^ @@ -106,7 +106,41 @@ Then, download our sample virtualhost file and proxy conf: curl -L -o /etc/nginx/sites-available/funkwhale.conf "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/nginx.conf" ln -s /etc/nginx/sites-available/funkwhale.conf /etc/nginx/sites-enabled/ -Ensure static assets and proxy pass match your configuration, and check the configuration is valid with ``nginx -t``. If everything is fine, you can restart your nginx server with ``service nginx restart``. +Ensure static assets and proxy pass match your configuration, and check the configuration is valid with ``nginx -t``. +If everything is fine, you can restart your nginx server with ``service nginx restart``. + +Apache2 +^^^^^^^ + +.. note:: + + Apache2 support is still very recent and the following features + are not working yet: + + - Websocket (used for real-time updates on Instance timeline) + - Transcoding of audio files + + Those features are not necessary to use your Funkwhale instance, and + transcoding in particular is still in alpha-state anyway. + +Ensure you have a recent version of apache2 installed on your server. +You'll also need the following dependencies:: + + apt install libapache2-mod-xsendfile + +Then, download our sample virtualhost file: + +.. parsed-literal:: + + curl -L -o /etc/apache2/sites-available/funkwhale.conf "https://code.eliotberriot.com/funkwhale/funkwhale/raw/|version|/deploy/apache.conf" + ln -s /etc/apache2/sites-available/funkwhale.conf /etc/apache2/sites-enabled/ + +You can tweak the configuration file according to your setup, especially the +TLS configuration. Otherwise, defaults, should work if you followed the +installation guide. + +Check the configuration is valid with ``apache2ctl configtest``, and once you're +done, load the new configuration with ``service apache2 restart``. About internal locations ~~~~~~~~~~~~~~~~~~~~~~~~