Question

Apache sub domain error.

Hi these are the configuration files for my Apache on CentOS 8.

The DNS (proiecto.net, www.proiecto.net and soporte.proiecto.net) are well-created pointing to the IP of my Centos server.

My file: /etc/httpd/conf.d/vhosts.conf:

======================================

<VirtualHost *:80>
   ServerName proiecto.net
   ServerAlias www.proiecto.net
   DocumentRoot /var/www/html
</VirtualHost>

<VirtualHost *:80>
   ServerName soporte.proiecto.net
   ServerAlias soporte.proiecto.net
   DocumentRoot /home/proiecto/soporte/html
</VirtualHost>

My file: /etc/hosts:

======================================
# Your system has configured 'manage_etc_hosts' as True.
# As a result, if you wish for changes to this file to persist
# then you will need to either
# a.) make changes to the master file in /etc/cloud/templates/hosts.redhat.tmpl
# b.) change or remove the value of 'manage_etc_hosts' in
#     /etc/cloud/cloud.cfg or cloud-config from user-data
# 
# The following lines are desirable for IPv4 capable hosts
127.0.0.1 proiecto-centos proiecto-centos
127.0.0.1 localhost.localdomain localhost
127.0.0.1 localhost4.localdomain4 localhost4

127.0.0.1 www.proiecto.net
127.0.0.1 proiecto.net
127.0.0.1 soporte.proiecto.net

# The following lines are desirable for IPv6 capable hosts
::1 proiecto-centos proiecto-centos
::1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6

The HTML file for soporte.proiecto.net exists in:

/home/proiecto/soporte/html/index.html

and should show only one basic message: “Hello world Soporte”

The problem:

When I enter the site www.proiecto.net it shows very well, but when I enter the site soporte.proiecto.net it shows the default Centos Apache configuration page (it should show a basic page with “Hello World”)**

Any suggestions? Thank you very much.

Edward Ocando Venezuela

edward.ocando@gmail.com

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

I believe that this could be due to the permissions of your /home/proiecto/soporte/html/ directory.

What I could suggest is following steps 4 and 5 here on how to setup your Vhosts and how to adjust your SELinux permissions on CentOS 8:

https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-centos-8#step-4-—-setting-up-virtual-hosts-(recommended)

Let me know how it goes! Regards, Bobby