Score:1

Apache and VirtualHosts in RedHat, Can't figure it out

cn flag

already did my research and Im burned after reading and watching videos for hours; I can't make virtual hosts works at all, it doest matter which configuration I set but Apache will ignore it and always try to load the content within /var/www/html

The goal is to write the address on a browser and access different sites like this app.example.ca, blog.example.ca, www.example.ca (Im running a recursive DNS server)

My current configuration (Although I've tried many others) is the next one:

http.conf (Default config, added a line):

IncludeOptional sites-enabled/*.conf

app.conf (Only virtual host config file):

<VirtualHost *:443>
        ServerName app.friscia.ca
        ServerAlias app.friscia.ca
        DocumentRoot /var/www/html/app
        ErrorLog /var/www/html/app/error.log
</VirtualHost>

DNS Zone Content:

$TTL 10800      ; 3 hours
friscia.ca              IN SOA  friscia.ca. hostmaster.friscia.ca. (
                                7          ; serial
                                86400      ; refresh (1 day)
                                3600       ; retry (1 hour)
                                604800     ; expire (1 week)
                                10800      ; minimum (3 hours)
                                )
                        NS      ns1.friscia.ca.
                        NS      ns2.friscia.ca.
                        A       10.211.55.10
$ORIGIN friscia.ca.
$TTL 300        ; 5 minutes
EZEQUIELLFR2FBC         A       10.211.55.100
                        TXT     "31ed3c4417f785d3f24002d6f3c02f2edc"
$TTL 10800      ; 3 hours
ns1                     A       10.211.55.10
ns2                     A       10.211.55.11
www                     A       10.211.55.10
app                     A       10.211.55.10
cn flag
I've disabled SELinux just to keep it simple until everything works, user and group owners of related files are set to apache.
digijay avatar
mx flag
Your IP is within the private range `10.0.0.0/8`, thus it can only be reached from within this network (usually an intranet), and not from the internet. Are you trying to connect from within this network? Also, your VHost config lacks the TLS/SSL key and certificate(s) which will lead to further errors
cn flag
Yes, it’s just to access within my intranet / lab. If I modify my hosts file it works, but just from the hosting gym of course.
digijay avatar
mx flag
Does an unencrypted connection (`<VirtualHost *:80>`) work?
cn flag
Same results. Trying to load only from /var/www/html/index.html ignoring virtual host config.
in flag
Please provide the exact error message you receive when you try this configuration.
cn flag
There's no error message at all; I just see the "Red Hat Enterprise Linux Test Page" whatever I try. If I put content in the folder /var/www/html it will load, but any VirtualHost configuration won't.
in flag
Did you restart or reload Apache after modifying the configuration files?
cn flag
I did; I know DNS records are working since I write the addresses www.friscia.ca, app.friscia.ca or blog.friscia.ca and I get somewhere, even from others devices in the network, but well, always the same place.
in flag
Then please provide the rest of your Apache configuration. The issue is not in the part you showed.
cn flag
Alright, I've deleted mod_ssl and now everything runs on 80. What's wrong with 443 and how could I make it work? Ports are allowed on firewall-cmd.
digijay avatar
mx flag
You'll have to switch on `SSLEngine` and provide it with a key and a certificate [see manual here](https://httpd.apache.org/docs/current/mod/mod_ssl.html)
cn flag
Thanks a lot ! Will read about it.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.