Skip to content

Instantly share code, notes, and snippets.

@wolegis
Last active February 19, 2023 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolegis/1659786ded9128935f638ee2bf228906 to your computer and use it in GitHub Desktop.
Save wolegis/1659786ded9128935f638ee2bf228906 to your computer and use it in GitHub Desktop.
Nextcloud sample configuration for Apache HTTPD when using a dedicated hostname for Nextcloud
<VirtualHost *:80>
ServerName nextcloud.example.com
Alias /.well-known/acme-challenge/ /srv/http/acme
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/\.well\-known/acme\-challenge/
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
</VirtualHost>
<VirtualHost *:443>
ServerName nextcloud.example.com
SSLEngine on
SSLCertificateFile "/path/to/your/chain"
SSLCertificateKeyFile "/path/to/your/privatekey"
Protocols h2 http/1.1
# HTTP Strict Transport Security (mod_headers is required) (63072000 seconds)
Header always set Strict-Transport-Security "max-age=63072000"
CustomLog "/var/log/httpd/access/nextcloud.log" common
DocumentRoot /usr/share/webapps/nextcloud
DirectoryIndex index.php index.html
<Directory /usr/share/webapps/nextcloud>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
</Directory>
<IfModule mod_dav.c>
Dav off
</IfModule>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm-legacy/nextcloud.sock|fcgi://nextcloud/"
</FilesMatch>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment