0

I'm running a local Apache server with no access outside my network. I want to be able to navigate to sites by the server name.

For example, where hostname is my server's hostname and home.lan is my local domain,

  • I CAN access Nextcloud using the alias via https://hostname.home.lan/nextcloud
  • I CANNOT access Nextcloud using the server name via https://nextcloud.hostname.home.lan

What's wrong with my virtual host setup below?

<IfModule mod_alias.c>
    Alias /nextcloud /usr/share/webapps/nextcloud/
</IfModule>

...

<VirtualHost *:443>
    DocumentRoot /usr/share/webapps/nextcloud
    ServerName nextcloud.hostname.home.lan
    ...
</VirtualHost>
4
  • What does exactly happen when you try to access the server name? (And does the name exist in DNS?) Commented May 3, 2020 at 18:19
  • When I try to access using the server name, I get a server not found error, the same as visiting any other invalid URL. I didn't change anything in DNS.
    – Kyle
    Commented May 4, 2020 at 1:05
  • I did some more digging after reading your comment and might know the issue. If I try to reach hostname.home.lan, I assume this is resolved in the router. And if I try to reach nextcloud.hostname.home.lan is the whole thing resolved in the router? In that case, I would need to update the router DNS to point the Nextcloud FQDN to the same hostname as the other FQDN.
    – Kyle
    Commented May 4, 2020 at 2:58
  • Yes, the entire domain name is resolved via DNS before it can even get to your Apache server. Subdomains are not automatic. Commented May 4, 2020 at 8:54

1 Answer 1

0

Since you are using https, you need to have a VirtualHost entry which listens on port 443, not just 80. You'll also need to specify relevant SSL directives for that VirtualHost block.

Also ensure that nextcloud.hostname.home.lan resolves to the proper IP address to be safe.

3
  • I tried using port 443 and got the same results, but good catch. I have the server certificate and key specified in the virtual host (updated answer with ellipsis for clarification). How would I check what nextcloud.hostname.home.lan resolves to since this is only on the internal network? Thanks!
    – Kyle
    Commented May 4, 2020 at 1:16
  • @Kyle you can ping it (ping nextcloud.hostname.home.lan) from a command prompt / terminal / shell and see what it comes back with.
    – g491
    Commented May 4, 2020 at 3:05
  • I get Name or service not known, likely because I don't have the proper DNS set up on the router as mentioned in the comments to the question. For some reason, none of the guides mention this step.
    – Kyle
    Commented May 4, 2020 at 14:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .