updated nextcloud config and corrected public-ip.

This commit is contained in:
2021-08-25 20:24:16 +00:00
parent f7426d991f
commit ef920ceabc
3 changed files with 25 additions and 16 deletions
+18 -14
View File
@@ -6,9 +6,10 @@ upstream php-handler {
}
server {
server_name DOMAIN_TO_USE;
listen 80;
listen [::]:80;
server_name DOMAIN_TO_USE;
# HSTS settings
# WARNING: Only add the preload option once you read about
@@ -16,7 +17,7 @@ server {
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
add_header Strict-Transport-Security "max-age=31536000" always;
# set max upload size
client_max_body_size 512M;
@@ -61,9 +62,6 @@ server {
# always provides the desired behaviour.
index index.php index.html /index.php$request_uri;
# Default Cache-Control policy
expires 1m;
# Rule borrowed from `.htaccess` to handle Microsoft DAV clients
location = / {
if ( $http_user_agent ~ ^DavClnt ) {
@@ -82,22 +80,23 @@ server {
# `location ~ /(\.|autotest|...)` which would otherwise handle requests
# for `/.well-known`.
location ^~ /.well-known {
# The following 6 rules are borrowed from `.htaccess`
# The rules in this block are an adaptation of the rules
# in `.htaccess` that concern `/.well-known`.
rewrite ^/\.well-known/host-meta\.json /public.php?service=host-meta-json last;
rewrite ^/\.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/\.well-known/webfinger /public.php?service=webfinger last;
rewrite ^/\.well-known/nodeinfo /public.php?service=nodeinfo last;
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location = /.well-known/carddav { return 301 /remote.php/dav/; }
location = /.well-known/caldav { return 301 /remote.php/dav/; }
location /.well-known/acme-challenge { try_files $uri $uri/ =404; }
location /.well-known/pki-validation { try_files $uri $uri/ =404; }
try_files $uri $uri/ =404;
# Let Nextcloud's API for `/.well-known` URIs handle all other
# requests by passing them to the front-end controller.
return 301 /index.php$request_uri;
}
# Rules borrowed from `.htaccess` to hide certain paths from clients
location ~ ^/(?:build|tests|config|lib|3rdparty|templates|data)(?:$|/) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) { return 404; }
# Ensure this block, which passes PHP files to the PHP process, is above the blocks
# which handle static assets (as seen below). If this block is not declared first,
@@ -134,6 +133,11 @@ server {
access_log off; # Optional: Don't log access to assets
}
# Rule borrowed from `.htaccess`
location /remote {
return 301 /remote.php$request_uri;
}
location / {
try_files $uri $uri/ /index.php$request_uri;
}
+1 -1
View File
@@ -28,7 +28,7 @@ if [[ -z "$dir_name" ]]; then
dir_name='/var/www/nextcloud'
fi
public_ip=`${LOCATION}/../public-ip.sh`
public_ip=`${LOCATION}/../4-public-ip.sh`
echo "----- Set NextCloud Domain --------------------------"
read -p "Domain (defaults to public-ip '${public_ip}'): " domain_name
if [[ -z "$domain_name" ]]; then