Results 1 to 6 of 6

Thread: Need Some Help Understanding and Configuring Apache

  1. #1
    Join Date
    Nov 2014
    Location
    Chicagoland
    Beans
    21
    Distro
    Ubuntu 20.04 Focal Fossa

    Need Some Help Understanding and Configuring Apache

    Hello everyone,

    Apologies if this is on the wrong subforum, wasn’t sure if I should post here on in Networking.

    Also sorry for the weird formatting, I wrote this out in a Google Doc and then copy+pasted it over here.

    I was hoping someone might be able to give me an in-depth explanation and/or walkthrough on how to get Apache on my home server configured the way I want. I have a basic grasp on this but I think there’s some pieces of the puzzle that I’m not understanding. I understand that I need to use Apache VirtualHosts, and I think I also need to have the sites listening on different port numbers? I’m just not sure how to get it all to fit together

    Desired Results:
    1. Nextcloud installed and accessible from Internet. So mydomain.ddns.net/nextcloud goes to my Nextcloud (unless it needs to be something like mydomain.ddns.netortnumber)

    2. A Wordpress site installed and accessible from Internet (which I know how to do assuming I can get Apache VirtualHosts to do what I’m wanting). So mydomain.ddns.net goes to my wordpress site, unless it needs to be something like mydomain.ddns.netortnumber

    3. Webmin installed and accessible from Internet (if applicable, can’t remember if Webmin is local only) (pretty sure I can get this working on my own once I understand VirtualHosts). So mydomain.ddns.net/webmin goes to Webmin for my server, unless it needs to be something like mydomain.ddns.netortnumber

    4. Have everything secured with HTTPS/SSL/TLS

    Basically, I need to understand how to configure virutalhosts to all share my single DDNS domain for 3+ separate services (Nextcloud, Wordpress, Webmin). Assuming that that’s even possible in the first place.

    If it is possible, I’m not sure if it will need to be setup like mydomain.ddns.net/page or mydomain.ddns.netortnumber

    My Setup:

    1. ASUS router running asuswrt-merlin 384.6 configured with my DDNS domain
    2. Ubuntu Server 18.04


    What I’ve Done So Far:


    1. 1. Installed LAMP stack following this article:


    (https://www.ostechnix.com/install-ap...-ubuntu-16-04/)

    “Hardened” Apache installation following this article:

    (https://hostadvice.com/how-to/how-to...-ubuntu-18-04/


    1. Opened ports 80 and 443 on my server (along with 22 which was already open so I can SSH into my server remotely)
    2. Installed Nextcloud following this article: (https://websiteforstudents.com/setup...p-7-1-support/)



    1. In apache ports.conf, I have three Listen statements, listening on 80,443, and 10000. I think in order for this to work, each service/instance has to be on a separate port number? So I was going to run Nextcloud on 10000, and then Webmin on something else



    1. I have a virtualhost file configured and enabled via a2ensite for nextcloud (configured as part of the aforementioned installation process), along with the default virtualhost files (000-default.conf and default-ssl.conf)


    The Problem(s):


    1. I don’t understand the difference between /var/www/html and /var/www/. I understand that /html is the “Apache Default site”, and I can reach the default apache page when I’m on my LAN. And I understand that additional websites should be created in www rather than www/html, but what’s confusing about this is that Nextcloud is installed in www/html/nextcloud. Shouldn’t it be www/nextcloud? Is www the “root” of the Apache server? If so, then do I even need the www/html folder? And can I just move the Nextcloud installation from www/html to www?



    1. I can reach my Nextcloud via the Internet when I go to mydomain.ddns.net/nextcloud, however I would expect that mydomain.ddns.net by itself should show the default Apache page shouldn’t it? But instead I get “This site can’t provide a secure connection - mydomain.ddns.net sent an invalid response: “ERR_SSL_PROTOCOL_ERROR”. I don’t know what to do about this.



    1. When going through the process to automatically obtain a Let’s Encrypt cert, do I need a separate cert for every site on the Apache server? Or can I just have one cert that applies to the entire apache server regardless of how many sites are on it?



    1. I found this article on getting a Lets Encrypt cert, but part of the prerequisites include “Both of the following DNS records set up for your server...”, but, set up where? Whose DNS? Do I need to have a local DNS server running as well? My DDNS domain is registered with no-ip and is also configured on my router so the domain should always be pointing to my WAN IP. Is that sufficient or do I need something more?

      (https://www.digitalocean.com/communi...n-ubuntu-18-04)



    1. In general I’m just having trouble wrapping my head around this, and I’m not sure if it even CAN work the way I want it to, and since I’m new to this I don’t know what I don’t know so I’m not entirely sure what I should be asking.


    Can someone tell me what I’m missing here or point me in the right direction to be able to accomplish my Desired Results. I’m brand new to Apache and web hosting in general so I’m kinda just learning this as I go along. Please don’t hesitate to point me to any relevant documentation although I may have to ask additional questions if I don’t understand it.

    Thanks in advance!
    Last edited by wildmanne39; September 14th, 2018 at 02:45 AM. Reason: Normalized Fonts

  2. #2
    Join Date
    Feb 2008
    Location
    Texas
    Beans
    29,807
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Need Some Help Understanding and Configuring Apache

    Please use the default font color and properties unless you need to highlight or draw attention to a part of your post.

    Yes this is the correct sub-forum for your topic.

  3. #3
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,690
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Need Some Help Understanding and Configuring Apache

    You do not "have to" have multiple virtual hosts defined. You could just use the default configs that already exist and install your software to sub-folders.

    Example:

    Code:
    /var/www/html/nextcloud/
    /var/www/html/wordpress/
    /var/www/html/webmin/
    You will likely need to add directory-specific directives though.

    If you can use different hosts in your domain name, I would use those and create separate virtual hosts such as:

    files.mydomain.ddns.net which points to /var/www/nextcloud
    wordpress.mydomain.ddns.net which points to /var/www/wordpress
    webmin.mydomain.ddns.net which points to /var/www/webmin

    And have a separate .conf file for each site.

    A single apache .conf for all sites means one SSL for all of them. Separate apache .conf files means separate SSL for each site unless you use a wildcard certificate.

    You probably do not want to use DNS authorization for LetsEncrypt (CertBot) and instead let it modify files directly on the websites which is should have access to. I cannot give you any advice on CertBot since I am just now starting to figure out and document how to use it...but do not have it working just yet. I am concentrating on creating a local certificate authority for internal services before tackling the external SSL.

    LHammonds

  4. #4
    Join Date
    Nov 2014
    Location
    Chicagoland
    Beans
    21
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Need Some Help Understanding and Configuring Apache

    Quote Originally Posted by wildmanne39 View Post
    Please use the default font color and properties unless you need to highlight or draw attention to a part of your post.

    Yes this is the correct sub-forum for your topic.
    Is everything not regular black? It looks black to me?
    Last edited by Abdul_Hakim; September 17th, 2018 at 03:38 PM.

  5. #5
    Join Date
    Nov 2014
    Location
    Chicagoland
    Beans
    21
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Need Some Help Understanding and Configuring Apache

    Quote Originally Posted by LHammonds View Post
    You do not "have to" have multiple virtual hosts defined. You could just use the default configs that already exist and install your software to sub-folders.

    Example:

    Code:
    /var/www/html/nextcloud/
    /var/www/html/wordpress/
    /var/www/html/webmin/
    You will likely need to add directory-specific directives though.

    If you can use different hosts in your domain name, I would use those and create separate virtual hosts such as:

    files.mydomain.ddns.net which points to /var/www/nextcloud
    wordpress.mydomain.ddns.net which points to /var/www/wordpress
    webmin.mydomain.ddns.net which points to /var/www/webmin

    And have a separate .conf file for each site.

    A single apache .conf for all sites means one SSL for all of them. Separate apache .conf files means separate SSL for each site unless you use a wildcard certificate.

    You probably do not want to use DNS authorization for LetsEncrypt (CertBot) and instead let it modify files directly on the websites which is should have access to. I cannot give you any advice on CertBot since I am just now starting to figure out and document how to use it...but do not have it working just yet. I am concentrating on creating a local certificate authority for internal services before tackling the external SSL.

    LHammonds
    Thanks man that really helps. Unfortunately no-ip doesn't enable subdomains for free, so I guess I gotta just cough up the $10 a year for a proper domain. Although I'm still not sure where potentially configuring DNS fits into the picture.

    I may have to post additional questions in this thread down the road if I bump into any more obstacles (which is likely...lol)
    Last edited by Abdul_Hakim; September 17th, 2018 at 04:06 PM.

  6. #6
    Join Date
    Sep 2011
    Location
    Behind you!
    Beans
    1,690
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Need Some Help Understanding and Configuring Apache

    Quote Originally Posted by Abdul_Hakim View Post
    Although I'm still not sure where potentially configuring DNS fits into the picture.
    If you are talking about the Certbot method of domain validation, that just means adding a TXT record with a unique string provided by Certbot which will tell Certbot that you have control over the domain rather than some yahoo that is lying and trying to do something malicious.

    If you are talking about DNS in terms of the Apache configuration, DNS is everything to do with it. You typically get one IP address and a single server that needs to host multiple sites...even on different domains or sub-domains. When an inbound web browser is hitting the server, Apache knows where to send the browser based on how it is getting to the server in the 1st place. If the browser's URL has "mydomain.com" then Apache will look at your config files in "sites-enabled" to see if there are any matching definitions to that name and direct the browser to the correct website. This is over-simplifying the process but it is the basics to understand what it is doing.

    LHammonds

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •