{"id":24173076,"url":"https://github.com/stowyh/nextcloud-setup","last_synced_at":"2026-04-12T03:32:04.402Z","repository":{"id":217200646,"uuid":"743281000","full_name":"stowyh/nextcloud-setup","owner":"stowyh","description":" Build your own self-hosted cloud storage with Nextcloud, with enhanced privacy and security for file management","archived":false,"fork":false,"pushed_at":"2025-02-28T02:06:38.000Z","size":748,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-20T10:43:45.240Z","etag":null,"topics":["apache","apache2","debian-linux","debian-server","mariadb","nextcloud","nextcloud-installation","nextcloud-server","php","php8","privacy","security","ubuntu-server"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stowyh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-01-14T21:27:04.000Z","updated_at":"2025-02-28T02:06:42.000Z","dependencies_parsed_at":"2024-03-03T19:49:04.257Z","dependency_job_id":"3f8232ce-eaea-4977-b072-4d2e85a52e0a","html_url":"https://github.com/stowyh/nextcloud-setup","commit_stats":null,"previous_names":["antoinebit/nextcloud-setup","antoinepcap/nextcloud-setup","ankerfs/nextcloud-setup","zenithn/nextcloud-setup","sonosq/nextcloud-setup","zewth/nextcloud-setup","stowyh/nextcloud-setup"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stowyh/nextcloud-setup","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stowyh%2Fnextcloud-setup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stowyh%2Fnextcloud-setup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stowyh%2Fnextcloud-setup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stowyh%2Fnextcloud-setup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stowyh","download_url":"https://codeload.github.com/stowyh/nextcloud-setup/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stowyh%2Fnextcloud-setup/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31703498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T21:17:31.016Z","status":"online","status_checked_at":"2026-04-12T02:00:06.763Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","apache2","debian-linux","debian-server","mariadb","nextcloud","nextcloud-installation","nextcloud-server","php","php8","privacy","security","ubuntu-server"],"created_at":"2025-01-13T01:14:21.313Z","updated_at":"2026-04-12T03:32:04.394Z","avatar_url":"https://github.com/stowyh.png","language":null,"readme":"# Create Your Own Self-Hosted Cloud Storage\n\n## Benefits\n- Enhanced privacy and security\n- Cost-effective\n- Scalable\n- Greater control and customization\n\n## Prerequisites\n- A computer running Ubuntu or any Debian-based distribution.\n- Verify if your ISP allows port forwarding [Optional]\n- Own a domain [Optional]\n\n## Initial Server Setup\n\n### Update Your Linux Distribution\n```bash\nsudo apt update\nsudo apt full-upgrade\nsudo apt autoremove\n```\n\n### Install Necessary Packages\n```bash\nsudo apt install apache2 libapache2-mod-php neovim wget mariadb-server php php-apcu php-bcmath php-bz2 php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml unzip nmap ffmpeg\n```\n\n### Update Your Hostname (Optional)\n- Modify the file to assign an appropriate hostname or domain name to your server.\n\n```bash\nsudo nvim /etc/hostname\n```\n![hostname.png](pictures/hostname.png)\n\n```bash\nsudo nvim /etc/hosts\n```\n![hosts.png](pictures/hosts.png)\n\n- Restart your server to apply the changes.\n\n```bash\nsudo reboot\n```\n\n## Downloading Nextcloud\n- Download the Nextcloud ZIP file.\n\n```bash\nwget https://download.nextcloud.com/server/releases/latest.zip\n```\n\n## MariaDB Setup\n- Check the status of the `mariadb` service.\n\n```bash\nsystemctl status mariadb\n```\n\n- Run the secure installation script.\n\n```bash\nsudo mysql_secure_installation\n```\n\n- Follow the prompts with the provided inputs:\n\n```\nPassword prompt --\u003e Press Enter\nSwitch to unix_socket_auth [Y/n] --\u003e n\nChange the root password [Y/n] --\u003e Y\nEnter your secure password:\nRemove anonymous users [Y/n] --\u003e Y\nDisallow root login remotely [Y/n] --\u003e Y\nRemove test database and access to it [Y/n] --\u003e Y\nReload privilege tables now [Y/n] --\u003e Y\n```\n\n## Setting Up the Nextcloud Database\n- Access MariaDB.\n\n```bash\nsudo mariadb\n```\n\n- Create the database.\n\n```sql\nCREATE DATABASE nextcloud;\n```\n\n- Set up permissions.\n\n```sql\nGRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'mypassword';\nFLUSH PRIVILEGES;\n```\n\n- Exit by pressing `CTRL+D`.\n\n## Deploy Nextcloud Files\n\n- Enable the necessary PHP extensions.\n\n```bash\nsudo phpenmod bcmath bz2 gmp imagick intl\n```\n\n- Unzip the Nextcloud file.\n\n```bash\nunzip latest.zip\n```\n\n- Move the files to the serving location and set the appropriate permissions.\n\n```bash\nmv nextcloud your.domain.name\nsudo chown -R www-data:www-data your.domain.name\nsudo mv your.domain.name /var/www\n```\n\n- Disable the default Apache site.\n\n```bash\nsudo a2dissite 000-default.conf\n```\n\n## Configure Nextcloud Host\n- Create an Apache config file for serving Nextcloud.\n\n```bash\nsudo nvim /etc/apache2/sites-available/your.domain.name.conf\n```\n\n- Insert the following content into the file, modifying `your.domain.name` as needed:\n\n```bash\n\u003cVirtualHost *:80\u003e\n    DocumentRoot \"/var/www/your.domain.name\"\n    ServerName your.domain.name\n\n    \u003cDirectory \"/var/www/your.domain.name/\"\u003e\n        Options MultiViews FollowSymlinks\n        AllowOverride All\n        Order allow,deny\n        Allow from all\n    \u003c/Directory\u003e\n\n    TransferLog /var/log/apache2/your.domain.name_access.log\n    ErrorLog /var/log/apache2/your.domain.name_error.log\n\u003c/VirtualHost\u003e\n```\n\n- Enable the site.\n\n```bash\nsudo a2ensite your.domain.name.conf\n```\n\n## PHP Configuration\n- Edit the PHP configuration file (replace 8.3 with your PHP version if different).\n\n```bash\nsudo nano /etc/php/8.3/apache2/php.ini\n```\n\n- Locate and modify the following parameters:\n\n```php\nmemory_limit = 3G # Increase if you have more RAM\nupload_max_filesize = 50G # Adjust based on your needs\nmax_execution_time = 3600\npost_max_size = 50G # Adjust based on your needs\ndate.timezone = Europe/London # Adjust your timezone\nopcache.enable=1\nopcache.interned_strings_buffer=128\nopcache.max_accelerated_files=10000\nopcache.memory_consumption=128\nopcache.save_comments=1\nopcache.revalidate_freq=1\n```\n\n[Timezones](https://www.php.net/manual/en/timezones.php)\n\n- Enable PHP modules for Apache.\n\n```bash\nsudo a2enmod dir env headers mime rewrite ssl\n```\n\n- Restart Apache.\n\n```bash\nsudo systemctl restart apache2\n```\n\n## Network Configuration\nTo access Nextcloud securely, you should configure your network and domain before completing the installation.\n\n### Port Forwarding (For Home Servers)\n- Enable port forwarding on your router for ports 80 (HTTP) and 443 (HTTPS) to your server's IP address.\n- Example configuration for a Movistar router:\n\n1. Find your private IP using:\n\n```bash\nifconfig -a\n```\n\n![ifconfig.png](pictures/ifconfig.png)\n\n2. Configure port forwarding in your router settings.\n3. Verify ports are open:\n\n```bash\nsudo nmap -n -PN -sT -sU -p80,443 {IP}\n```\n\n### Configure Your Domain (Optional but Recommended)\n\n- Purchase or obtain a domain from providers like Namecheap, Cloudflare, etc.\n- In your DNS settings, create an `A` record pointing to your public IP.\n\n![namecheap_host.png](pictures/namecheap_host.png)\n\n## TLS Certificate (HTTPS)\n\n- Secure your installation with a free certificate from Let's Encrypt.\n- Install `snapd` and `certbot`:\n\n```bash\nsudo apt install snapd\nsudo snap install core \u0026\u0026 sudo snap refresh core\nsudo snap install --classic certbot\nsudo ln -s /snap/bin/certbot /usr/bin/certbot\n```\n\n- Obtain and install your certificates:\n\n```bash\nsudo certbot --apache\n```\n\n## Set Up Nextcloud Web Server\n- Access your Nextcloud instance via your domain (e.g., `https://your.domain.name`).\n- Upon first access, you will see a setup page.\n\n![admin.png](pictures/admin.png)\n\n- Enter the following information:\n\n```txt\nUsername --\u003e Your desired username\nPassword --\u003e Set a secure password\nData Folder --\u003e Leave as default\nDatabase user --\u003e nextcloud\nDatabase password --\u003e Your database password\nDatabase name --\u003e nextcloud\n```\n\n- Install the recommended apps.\n\n## Post-Installation Optimization\n\n### Background Jobs\n- Set up a cron job for the `www-data` user to execute background tasks.\n\n```bash\nsudo crontab -u www-data -e\n```\n\n- Add the following line to the file:\n\n```cron\n*/5  *  *  *  * php -f /var/www/your.domain.name/cron.php\n```\n\n### Memory Caching\n- Enable APCu for local caching by editing the config file.\n\n```bash\nsudo nvim /var/www/your.domain.name/config/config.php\n```\n\n- Add the following line to the configuration array:\n\n```php\n'memcache.local' =\u003e '\\OC\\Memcache\\APCu',\n```\n\n### Trusted Domains (If Needed)\n- If you change your domain or IP later, edit `config.php`:\n\n```bash\nsudo nvim /var/www/your.domain.name/config/config.php\n```\n\n- Add your new domain or IP to the `trusted_domains` array.\n\n![trusted.png](pictures/trusted.png)\n\n## Troubleshooting\n- Search online forums for solutions.\n\n## Resources\n- [Nextcloud Documentation](https://docs.nextcloud.com/)\n- [Nextcloud Community](https://help.nextcloud.com/)\n\n**Please submit a pull request for any errors or suggestions.**","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstowyh%2Fnextcloud-setup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstowyh%2Fnextcloud-setup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstowyh%2Fnextcloud-setup/lists"}