# Install Nextcloud with Apache 2 | locally

#### Manual install using Apache 2

Get zip file  
 `wget [https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip](https://download.nextcloud.com/server/releases/nextcloud-22.2.0.zip)` (find the lates version)  
  
Unzip it: Download unzip if needed  
 `unzip name.zip` then file name.zip  
  
 Change ownership of Nextcloud directory so apache is the owner  
`    sudo chown www-data:www-data -R nextcloud`

Move nextcloud dir to the location Apache searches for its own folders  
`    sudo mv nextcloud /var/www/html/`

Create configuration file for that directory (using APACHE2)  
`    sudo nano /etc/apache2/sites-available/nextcloud.conf`  
  
Use the following and edit whats needed

```
<VirtualHost *:80>
        DocumentRoot ****/var/www/html/nextcloud/
        ServerName familystronhold.onthewifi.com

 <Directory /var/www/html/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted
            <IfModule mod_dav.c>
               Dav off
            </IfModule>
            SetEnv HOME /var/www/html/nextcloud
            SetEnv HTTP_HOME /var/www/html/nextcloud
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>
```

Enable nextcould config file for Apache  
`    sudo a2ensite nextcloud.conf`  
Restart apache2  
`    sudo systemctl restart apache2`  
Disable test page  
`    sudo a2dissite 000-default`  
Enable some modules on apache2 for nextcloud  
`   sudo a2enmod rewrite headers env dir mime`  
Restart apache2 again  
Install a certificate bot REPO for "lets encrypt"  
 Go to: https://certbot.eff.org/lets-encrypt/ubuntufocal-apache