Link to home
Start Free TrialLog in
Avatar of domgarofalo
domgarofalo

asked on

Create a subdomain on apache2

How do I create a subdomain in apache2 for a domain that I am hosting on my Raspberry Pi? Next, how do I set up the A record to point to the subdomain?
ASKER CERTIFIED SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Congrats - You run a web site on your Raspberry PI.
How do you plan to deploy it?
Do you want to access it only from your private network? Is it a home network or a business network?
Do you want to access it from the Internet?

You will have to deal with 3 configurations:
a. A DNS server must point the subdomain somewhere
b. Depending on the type of your network (see questions above) you may have to configure your router
c. Your Apache must recognize the new subdomain

Regarding Apache - the default Apache config is server name and subdomain agnostic. Any FQDN pointing to the server where Apache runs will be served. So, assuming your PI has address of 3.14.15.92, you may have
mydomain.com
www.mydomain.com
another.subdomain.anotherdomain.com
all pointing to 3.14.15.92, and all will be served exactly the same default configuration by Apache.

You only need virtual hosts defined when you want different content for different host names.
Avatar of domgarofalo
domgarofalo

ASKER

Did what you said and it's working now. Thanks!