Hello again.
After some months of learning I managed to set up my website. It works within WordPress hosted on my little Raspberry Pi and is managed by No-IP with SSL certificates. The WordPress stuff is stored onto one dedicated SSD.Now I want to achieve the same with NextCloud, already stored on → another ← SSD, mounted to the file system the same way as the WordPress SSD. As far as I can tell it by now everything within this storage location is chown ’ ed correctly to one single user by now. MariaDB database for NextCloud is also set up. I can reach every SSD with SFTP locally and via the Internet without any problems, additionally I can reach everything with Samba on my local network. UFW firewall is setup, File2Ban is already securing everything - just not the NextCloud thing as it is stored but not installed by now.So just like WordPress I intend to start the installation process of NextCloud via the internet - not locally! What I would like to achieve in the end is to reach my NextCloud installation by entering something like this into my browser:https://mydomain.ddns.net/nextcloud (not working link, just example).Right now any SSD mounted to the file system is placed within a directory called “storage”, so the server root of NGINX right now looks something like this:root /storage/WordPress;My question now: How can I “include” the NextCloud stuff into the NGINX configuration file to achieve the addressing method mentioned above (https://mydomain.ddns.net/nextcloud)? I’ve been reading so many NGINX documentations and user specific example descriptions by now that I am totally confused. And I don’t want to mess up my by now working NGINX configuration again (had to re-configure everything several times…). Learning by doing…Right now my configuration looks like this (note that the real domain name used right now obviously is not “mydomain”):
##
# You should look at the following URL’s in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# Nginx/DirectoryStructure - Debian Wiki
#
# In most cases, administrators will remove this file from sites-enabled/ and
# leave it as reference inside of sites-available where it will continue to be
# updated by the nginx packaging team.
#
# This file will automatically load configuration files provided by other
# applications, such as Drupal or Wordpress. These applications will be made
# available underneath a path with that package name, such as /drupal8.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
# Default server configuration
#
server {
listen 80 default_server;
listen \[::\]:80 default_server;
\# SSL configuration
\#
\# listen 443 ssl default_server;
\# listen \[::\]:443 ssl default_server;
\#
\# Note: You should disable gzip for SSL traffic.
\# See: https://bugs.debian.org/773332
\#
\# Read up on ssl_ciphers to ensure a secure configuration.
\# See: https://bugs.debian.org/765782
\#
\# Self signed certs generated by the ssl-cert package
\# Don't use them in a production server!
\#
\# include snippets/snakeoil.conf;
root /storage/WordPress;
\# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name \_;
location / {
\# First attempt to serve request as file, then
\# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
\# pass PHP scripts to FastCGI server
\#
location \~ \\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
\# deny access to .htaccess files, if Apache's document root
\# concurs with nginx's one
\#
#location \~ /\\.ht {
\# deny all;
#}
#Put our rewrite rules here, i.e.
\#
rewrite wp-content/uploads/\_pda(\\/\[A-Za-z0-9\_@.\\/&+-\]+)+\\.(\[A-Za-z0-9\_@.\\/&+-\]+)$ "/index.php?pda_v3_pf=$1&is_direct_access=true&file_type=$2" last;
rewrite private/(\[a-zA-Z0-9-\_.\]+)$ "/index.php?pda_v3_pf=$1" last;
}
# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
#server {
# listen 80;
# listen [::]:80;
#
# server_name example.com;
#
# root /var/www/example.com;
# index index.html;
#
# location / {
# try_files $uri $uri/ =404;
# }
#}
server {
\# SSL configuration
\#
\# listen 443 ssl default_server;
\# listen \[::\]:443 ssl default_server;
\#
\# Note: You should disable gzip for SSL traffic.
\# See: https://bugs.debian.org/773332
\#
\# Read up on ssl_ciphers to ensure a secure configuration.
\# See: https://bugs.debian.org/765782
\#
\# Self signed certs generated by the ssl-cert package
\# Don't use them in a production server!
\#
\# include snippets/snakeoil.conf;
root /storage/WordPress;
\# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name mydomain.ddns.net; # managed by Certbot
location / {
\# First attempt to serve request as file, then
\# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
\# pass PHP scripts to FastCGI server
\#
location \~ \\.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
}
\# deny access to .htaccess files, if Apache's document root
\# concurs with nginx's one
\#
#location \~ /\\.ht {
\# deny all;
#}
listen \[::\]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.ddns.net/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.ddns.net/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
add_header Content-Security-Policy “default-src ‘self’ https://*.google-analytics.com https://*.googleapis.com https://*.gstatic.com https://*.gravatar.com https://*.w.org data: ‘unsafe-inline’ ‘unsafe-eval’;” alw>
add_header X-Xss-Protection “1; mode=block” always;
add_header X-Frame-Options “SAMEORIGIN” always;
add_header X-Content-Type-Options “nosniff” always;
add_header Referrer-Policy “origin-when-cross-origin” always;
add_header Permissions-Policy “geolocation=*, camera=(self ‘https://example.com’), microphone=()”;
}
server {
if ($host = mydomain.ddns.net) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen \[::\]:80 ;
server_name mydomain.ddns.net;
return 404; # managed by Certbot
\##
\# Nginx Bad Bot Blocker Includes
\# REPO: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker
\##
include /etc/nginx/bots.d/ddos.conf;
include /etc/nginx/bots.d/blockbots.conf;
}
Any help on this is very welcome! Thanks in advance!
Jens