Hi everyone!
I had to reinstall my Nextcloud application but I am struggling at the last step!
I created a docker compose with customized folders for data, html and database. The goal eventually is mainly to have a folder data on another partition of my server
Please find the docker-compose below.
The application is running perfectly as long as I stay in local. When I call the IP:8085, no problem I can navigate through the application.
I then tried to configure apache to make it available online. This is where I have an issue.
I followed the documentation in order to configure apacheand activate the reauired modules.
I also used cerbot to generate and implement the ssl certificate zith the command sudo certbot --apache
.
I put the :80 and :443 .conf files below.
My problem is that when I try to access nextcloud using the domain name, I reach the Internal server error page even though the application is well running.
I couldn’t find anything neither in the Apache’s error and access logs, nor in the nextcloud.log.
I’m pretty sure there is an issue with rights or links between nextcloud folders and apache directoriees but I couldn’t find any relevant information about it so far…
Thank you for your help on this!!
The docker-compose file:
version: '3.8'
services:
#######################################
########## NEXTCLOUD ##########
#######################################
nextcloud-db-test:
image: postgres:alpine
container_name: nextcloud-db-test
restart: always
volumes:
- /docker/Nextcloud2/database:/var/lib/postgresql/data
env_file:
- .nextcloud_db.env
nextcloud-redis-test:
image: redis:alpine
container_name: nextcloud-redis-test
restart: always
nextcloud_cron-test:
image: nextcloud
container_name: nextcloud-cron-test
restart: always
volumes:
- /docker/Nextcloud2/html:/var/www/html
entrypoint: /cron.sh
depends_on:
- nextcloud-db-test
- nextcloud-app-test
nextcloud-app-test:
image: nextcloud:latest
container_name: nextcloud-app-test
restart: always
volumes:
- /docker/Nextcloud2/html:/var/www/html
- /docker/Nextcloud2/data:/var/www/html/data
ports:
- 8085:80
environment:
- POSTGRES_HOST=nextcloud-db-test
- REDIS_HOST=nextcloud-redis-test
- NEXTCLOUD_TRUSTED_DOMAINS=mydomain.example.com
- VIRTUAL_HOST=mydomain.example.com
env_file:
- .nextcloud_db.env
depends_on:
- nextcloud-db-test
- nextcloud-redis-test
The Nextcloud.conf file (for :80 requests)
<VirtualHost *:80>
ServerName mydomain.example.com
ServerAdmin webmaster@localhost
DocumentRoot /docker/Nextcloud2/html
ErrorLog ${APACHE_LOG_DIR}/Nextcloud-test-error.log
CustomLog ${APACHE_LOG_DIR}/Nextcloud-test-access.log combined
<Directory /docker/Nextcloud2/html>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
RewriteEngine on
RewriteCond %{SERVER_NAME} =volka-test.hkl.ovh
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
The Nextcloud-ssl.conf file (for https requests)
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerName mydomain.example.com
<IfModule mod_headers.c>
Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
</IfModule>
ServerAdmin mail@example.com
DocumentRoot /docker/Nextcloud2/html
ErrorLog ${APACHE_LOG_DIR}/Nextcloud-test-error.log
CustomLog ${APACHE_LOG_DIR}/Nextcloud-test-access.log combined
<Directory /docker/Nextcloud2/html>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
<IfModule mod_dav.c>
Dav off
</IfModule>
</Directory>
SSLCertificateFile /etc/letsencrypt/live/mydomain.example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/mydomain.example.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
</IfModule>