ยง2024-07-09

$ cat /etc/nginx/sites-enabled/upstream-45103 
# port 45103, to hc4bookworm.yushei.net:48501 nextCloud

server {
     server_name  munetaka.me:45103;
     charset utf-8;

     location / {
        proxy_pass http://hc4Bookworm.yushei.net:48501;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Host munetaka.me;
        proxy_set_header X-Forwarded-Port 45103;

     }

     listen 45103 ssl; # managed by Certbot
     ssl_certificate /etc/letsencrypt/live/munetaka.me/fullchain.pem; # managed by Certbot
     ssl_certificate_key /etc/letsencrypt/live/munetaka.me/privkey.pem; # managed by Certbot
}

And https://munetaka.me:45103 will reverse proxy to http://hc4bookworm.yushei.net:48501 nextcloud server, how to set up /var/www/nextcloud/config/config.php???


<?php
$CONFIG = array (
  'instanceid' => 'YOUR_INSTANCE_ID',
  'passwordsalt' => 'YOUR_PASSWORD_SALT',
  'secret' => 'YOUR_SECRET',
  'trusted_domains' => 
  array (
    0 => 'localhost',
    1 => 'hc4bookworm.yushei.net',
    2 => 'munetaka.me',
    3 => 'munetaka.me:45103',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => 'YOUR_NEXTCLOUD_VERSION',
  'overwritehost' => 'munetaka.me:45103',
  'overwriteprotocol' => 'https',
  'overwritewebroot' => '/',
  'overwritecondaddr' => '^YOUR_PROXY_SERVER_IP$', // optional
  'trusted_proxies' => 
  array (
    0 => 'YOUR_PROXY_SERVER_IP', // Replace with your proxy server IP
  ),
  'forwarded_for_headers' => array('HTTP_X_FORWARDED_FOR'),
  // other configurations...
);
'oc5kx4u32hmz', 'passwordsalt' => 'BtMO2oEEHrT908y6jx8T9rF4IrSwpG', 'secret' => '/b7ZjNpCgXwswa6keolVOLmq53Vp/Xfrv4rlDjpi5UvN8TJZ', 'trusted_domains' => // spcify who could access this site array ( 0 => 'hc4bookworm.yushei.net:48501', 1 => 'munetaka.me:45103', // 2 => 'fe80::21e:6ff:fe49:c5', // hc4Bookworm ip6 // 3 => '192.168.1.112', // when hooked in YS office ), // 'trusted_domains' => // array ( // 0 => 'munetaka.me:45103', // 1 => 'hc4bookworm.yushei.net:48501', // ), 'overwrite.cli.url' => 'https://munetaka.me', // 'overwriteprotocol' => 'https', 'datadirectory' => '/var/www/nextcloud/data', 'dbtype' => 'mysql', 'version' => '29.0.3.4', // 'overwrite.cli.url' => 'http://hc4bookworm.yushei.net:48501', // 'overwrite.cli.url' => 'https://munetaka.me:45103', 'htaccess.RewriteBase' => '/', 'dbname' => 'nextcloud_db', 'dbhost' => 'localhost', 'dbport' => '', 'dbtableprefix' => 'oc_', 'mysql.utf8mb4' => true, 'dbuser' => 'nextclouduser', 'dbpassword' => 'hc4Bookworm.yushei.net#20240708', 'installed' => true, 'appstoreenabled' => true, 'appstoreurl' => 'https://apps.nextcloud.com', 'appcodechecker' => false, 'updater.server.url' => 'https://updates.nextcloud.com/updater_server/', 'trusted_proxies' => array ( 0 => 'fe80::99ac:c8e9:8e35:ba39', ), 'allow_local_remote_servers' => true, 'local' => array ( 0 => 'fe80::99ac:c8e9:8e35:ba39', 1 => 'github.com', 2 => '192.30.253.112', 3 => '192.30.253.113', ), 'appstore.experimental.enabled' => false, 'mail_from_address' => 'alexlai', 'mail_smtpmode' => 'smtp', 'mail_sendmailmode' => 'smtp', 'mail_domain' => 'h2Jammy.yushei.net', 'mail_smtphost' => 'h2jammy.yushei.net', 'mail_smtpport' => '25', 'mail_smtpauth' => 1, 'mail_smtpname' => 'alexlai', 'mail_smtppassword' => 'alex1765', // apps store 'appstoreenabled' => true, 'appstoreurl' => 'https://apps.nextcloud.com/api/v1', // Server maintenance window start time 'maintenance_window_start' => '01:00', 'maintenance_window_end' => '05:00', 'default_phone_region' => 'TW', ); ```