Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ShapeShifter499/831bfd85921257711cb0aef6e8957f35 to your computer and use it in GitHub Desktop.
Save ShapeShifter499/831bfd85921257711cb0aef6e8957f35 to your computer and use it in GitHub Desktop.
/etc/http/conf/extra/nextcloud.conf
## Start of HTTP (80) insecure settings
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName nextcloud.example.com
## Set 'DocumentRoot' to the lcoation of Nextcloud so that it's the default service
DocumentRoot /usr/share/webapps/nextcloud
##
ErrorLog /var/log/httpd/nextcloud.example.com.info-error_log
CustomLog /var/log/httpd/nextcloud.example.com.info-access_log common
## FORCE HTTPS
Redirect permanent / https://nextcloud.example.com/
##
## Nextcloud HTTP, no 'Alias' is needed since Nextcloud is already set as default above
<Directory /usr/share/webapps/nextcloud>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm-nextcloud.sock|fcgi://localhost/"
</FilesMatch>
</Directory>
##
## Wallabag HTTP
Alias /wallabag /usr/share/webapps/wallabag/web
<Directory /usr/share/webapps/wallabag/web>
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm-wallabag.sock|fcgi://localhost/"
</FilesMatch>
</Directory>
<Directory /usr/share/webapps/wallabag/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
##
</VirtualHost>
##
## Start of HTTPS (443) secure settings
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName nextcloud.example.com
## Set 'DocumentRoot' to the lcoation of Nextcloud so that it's the default service
DocumentRoot /usr/share/webapps/nextcloud
##
ErrorLog /var/log/httpd/nextcloud.example.com.info-error_log
CustomLog /var/log/httpd/nextcloud.example.com.info-access_log common
## Enable Strict Transport Security for HTTPS
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
##
## HTTPS Proxy redirect for Syncthing because has it's own web server. (DO NOT add this to HTTP section above for security)
ProxyPass /syncthing/ http://127.0.0.1:8384/
ProxyPassReverse /syncthing/ http://127.0.0.1:8384/
##
## HTTPS Proxy redirect for ZNC IRC Bouncer because has it's own web server. (DO NOT add this to HTTP section above for security)
ProxyPass /znc/ http://127.0.0.1:6679/znc/
ProxyPassReverse /znc/ http://127.0.0.1:6679/znc/
##
## Nextcloud HTTPS, no 'Alias' is needed since Nextcloud is already set as default above
<Directory /usr/share/webapps/nextcloud>
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm-nextcloud.sock|fcgi://localhost/"
</FilesMatch>
</Directory>
##
## Wallabag HTTPS
Alias /wallabag /usr/share/webapps/wallabag/web
<Directory /usr/share/webapps/wallabag/web>
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php-fpm/php-fpm-wallabag.sock|fcgi://localhost/"
</FilesMatch>
</Directory>
<Directory /usr/share/webapps/wallabag/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
##
SSLCertificateFile /etc/letsencrypt/live/nextcloud.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment