• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Subdomains Not Working

R

raygp

Guest
I am having a problem with subdomains. I have a domain that has an exclusive IP Address and has subdomains.

Trying to access the subdomain just sends them to the main domain.

in other words:
subdomain.domain.com goes to the same as
www.domain.com

I tried to restart apache and got this message.

Stopping httpd: [ OK ]
Starting httpd: [Wed Dec 29 09:51:44 2004] [warn] VirtualHost 65.100.113.1:80 overlaps with VirtualHost 65.100.113.1:80, the first has precedence, perhaps you need a NameVirtualHost directive
[ OK ]

I tried changing the address to a shared address, that didn't help!

Also all subdomains on my main shared ip address work fine.
Do I need to add a NameVirtualHost somewhere in the conf?
 
I had this same problem, it was fixed with "/usr/local/psa/admin/sbin/websrvmng -a -v" and restart httpd
 
I'm having this same problem with subdomains. I've run the webservmng command to rebuild the conf file and it does correct the problem so that my subdomain works.

However the primary domain then fails!

I've checked the httpd.conf file within the domain directory and it points to the correct file system folders on the server.

Any suggestions please?
 
Hi there!

First way:

1. create a subdomain SUB.DOMAIN.COM in Plesk control panel:

Domains -> DOMAIN.COM -> Subdomains

2. then create vhost.conf file in the subdomain's config directory: /home/httpd/vhosts/DOMAIN.COM/subdomains/SUB/conf/vhost.conf and put the following record inside:

---
DirectoryRoot /home/httpd/vhosts/DOMAIN.COM/httpdocs
---

3. run "/usr/local/psa/admin/sbin/websrvmng -a -v" to apply the changes.

Now then you access http://sub.domain.com you'll get the main domain's content.

Second way:

2. put the following directive in the /home/httpd/vhosts/DOMAIN.COM/subdomains/SUB/conf/vhost.conf file:

---
Redirect / http://domain.com
---

In this way when you access http://sub.domain.com you'll be redirected to http://domain.com.

I didn't test this way by myself however hope this helps.
 
Back
Top