# How setup a local NC server so that it’s accessible by the local IP-address itself from inside a home network

**URL:** <https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348>\
**Category:** ℹ️ Support\
**Tags:** reverseproxy, nc29, local\_network, proxmox\
**Created:** [May 14, 2024, 1:47am UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348 "2024-05-14T01:47:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rcjca](https://help.nextcloud.com/letter_avatar/rcjca/32/6_22734026db12803ebb3e059622ac3534.png) [@rcjca](https://help.nextcloud.com/u/rcjca)\
**Post date:** [May 14, 2024, 1:47am UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/1 "2024-05-14T01:47:35Z")

</div>

Nextcloud version _(eg, 20.0.5)_: `29.0.0.19`  
Operating system and version _(eg, Ubuntu 20.04)_: `Debian 12`  
Apache or nginx version _(eg, Apache 2.4.25)_: `Apache/2.4.59 (Debian)`  
PHP version _(eg, 7.4)_: 8.2.18 (cli) (built: Apr 11 2024 22:07:45) (NTS)

I’m running a NC instance/server on a Proxmox Debian 12 VM with NGINX reverse proxy, on my LAN (Machine is a Dell Optiplex Desktop). NC works great when accessing it from the internet, via my (redacted) domain name [xxxxx.com](http://xxxxx.com), but when I try to access it from my LAN by typing the local IP address (192.168.1.40) of my NC server in a browser, I get the default Apache Landing page:

 ![image](https://help.nextcloud.com/uploads/default/original/3X/6/6/66b1019d3b22107e440900bea59c4530765af269.png)

My motivation for local access to NC is to be able to download NC files from my server to a home PC (on the same LAN) at my network speed (close to 1Gb/s), as opposed to the slow 10Mb/s upload limit imposed by my ISP. I would also like to access the NC server on my LAN when the internet is down.

I searched this forum and the internet for solutions, but could not find any specific instructions, only vague comments to the effect that this should be possible.

My Nextcloud `config.php` file:

```auto
<?php
$CONFIG = array (
  'instanceid' => 'ocnxoo18681c',
  'passwordsalt' => 'FxxxxxxxxxxxRQD3b/V',
  'secret' => '4I3wxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'xxxxx.com',
    1 => '192.168.1.40',
  ),
  'trusted_proxies' => 
  array (
    0 => '192.168.1.63',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '29.0.0.19',
  'overwrite.cli.url' => 'http://xxxxx.com',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextclouduser',
  'dbpassword' => '[xxxxxh',
  'installed' => true,
  'default_phone_region' => 'CA',
  'maintenance_window_start' => 8,
  'memories.db.triggers.fcu' => true,
  'memories.exiftool' => '/var/www/nextcloud/apps/memories/bin-ext/exiftool-amd64-glibc',
  'memories.vod.path' => '/var/www/nextcloud/apps/memories/bin-ext/go-vod-amd64',

```

My apache2 `nextcloud.conf` file:

```auto
<VirtualHost *:80>
    ServerName xxxxx.com
    DocumentRoot /var/www/nextcloud/

    # log files
    ErrorLog /var/log/apache2/files.xxxxx.com-error.log
    CustomLog /var/log/apache2/files.xxxxx.com-access.log combined

    <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
	AllowOverride All

	<IfModule mod_dav.c>
	    Dav off
	</IfModule> 

	SetEnv HOME /var/www/nextcloud
	SetEnv HTTP_HOME /var/www/nextcloud
     </Directory>
</VirtualHost>

```

Any help appreciated.

---

<div class="post-metadata">

**Author:** ![NextMeIsOnline](https://help.nextcloud.com/letter_avatar/nextmeisonline/32/6_22734026db12803ebb3e059622ac3534.png) [@NextMeIsOnline](https://help.nextcloud.com/u/NextMeIsOnline)\
**Post date:** [May 14, 2024, 8:59am UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/2 "2024-05-14T08:59:15Z")

</div>

Have you tried  
192.168.1.40/nextcloud

as the address?

The IP by itself leads to the Apache landing page by default, so you have to specify where you want to go. Usually that’s done by adding /nextcloud to the IP, but depending on your setup it could be different.

---

<div class="post-metadata">

**Author:** ![rcjca](https://help.nextcloud.com/letter_avatar/rcjca/32/6_22734026db12803ebb3e059622ac3534.png) [@rcjca](https://help.nextcloud.com/u/rcjca)\
**Post date:** [May 14, 2024, 11:02am UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/3 "2024-05-14T11:02:58Z")

</div>

`http://192.168.1.40/nextcloud` gives this:  
 ![image](https://help.nextcloud.com/uploads/default/original/3X/d/a/da8ec72bc9d09061ed560641ca5702955c1426c7.png)

Same thing with `http://192.168.1.40/index.php/apps/dashboard/`

Changing the server name in my apache `nextcloud.conf` file from my NC domain name to my server’s IP address:

```auto
<VirtualHost *:80>
    ServerName 192.168.1.40
    DocumentRoot /var/www/nextcloud/

    # log files
    ErrorLog /var/log/apache2/files.xxxxx.com-error.log
    CustomLog /var/log/apache2/files.xxxxx.access.log combined

    <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All

        <IfModule mod_dav.c>
            Dav off
        </IfModule>

        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
     </Directory>
</VirtualHost>

```

then restarting apache (`systemctl restart apache2`) and then pointing a browser (Firefox) to `http://192.168.1.40/apps/dashboard/#/` works, but I no longer have WAN access. I guess I could do that manually each time I need to …

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 14, 2024, 2:36pm UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/4 "2024-05-14T14:36:41Z")

</div>

You can add the IP by using the [ServerAlias](https://httpd.apache.org/docs/2.4/mod/core.html#serveralias) directive, as follows…

```auto
<VirtualHost *:80>
    ServerName xxxxx.com
    ServerAlias 192.168.1.40
    DocumentRoot /var/www/nextcloud/

    # log files
    ErrorLog /var/log/apache2/files.xxxxx.com-error.log
    CustomLog /var/log/apache2/files.xxxxx.access.log combined

    <Directory /var/www/nextcloud/>
        Options +FollowSymlinks
        AllowOverride All

        <IfModule mod_dav.c>
            Dav off
        </IfModule>

        SetEnv HOME /var/www/nextcloud
        SetEnv HTTP_HOME /var/www/nextcloud
     </Directory>
</VirtualHost>

```

And I would also recommend disabling the default virtualhost:

```
a2dissite 001-default.conf && systemctl restart apache2

```

---

<div class="post-metadata">

**Author:** ![bb77](https://help.nextcloud.com/letter_avatar/bb77/32/6_22734026db12803ebb3e059622ac3534.png) [@bb77](https://help.nextcloud.com/u/bb77)\
**Post date:** [May 14, 2024, 3:05pm UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/5 "2024-05-14T15:05:57Z")

</div>

> [@NextMeIsOnline](#):
>
> 192.168.1.40/nextcloud

The default Apache webroot is in `/var/www/html`, so `192.168.1.40/nextcloud` wouldn’t work. To make it work, Nextcloud would have to be installed in `/var/www/html/nextcloud` and the path in the `<Directory>` section of the above configuration would have to be changed accordingly and then the section would have to be added to the `<VirtualHost>` section of the `000-default.conf` file. However, I wouldn’t recommend using subdirectories, unless you want to access multiple services on the same server by IP address, which I wouldn’t recommend in the first place.

A better way to do this would be to use local DNS / split-brain DNS, so that you can access all your services via FQDN (Fully Qualified Domain Name) also from your local network. So even the solution I suggested above with the `ServerAlias` directive, while probably working for @rcjca’s use case, is only a suboptimal solution, imho.

---

<div class="post-metadata">

**Author:** ![rcjca](https://help.nextcloud.com/letter_avatar/rcjca/32/6_22734026db12803ebb3e059622ac3534.png) [@rcjca](https://help.nextcloud.com/u/rcjca)\
**Post date:** [May 14, 2024, 6:08pm UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/6 "2024-05-14T18:08:50Z")

</div>

Many many thanks. The ‘ServerAlias’ directive worked. I also disabled the default virtual host as suggested. I can now access NC from both my LAN and WAN. 😀

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [May 22, 2024, 6:09pm UTC](https://help.nextcloud.com/t/how-setup-a-local-nc-server-so-that-it-s-accessible-by-the-local-ip-address-itself-from-inside-a-home-network/192348/7 "2024-05-22T18:09:33Z")

</div>

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.
