Hi,
I have a brand new WHM 11.46.0 (build 12) on a VPS. I only have a single IP on the VPS
My hostname is server.domain.com
I'm trying to get a subdomain working with a virtualhost, so that www.domain.com and sub.domain.com have different DocumentRoots.
Now, WHM autogenerated the following in httpd.conf:
I added the following to the "Post VirtualHost" include file:
In this case, the default /usr/local/apache/htdocs/index.html page is loaded - the auto-generated Virtualhost for WHM.
If I put this in the "Pre VirtualHost" include file instead, it makes no difference.
Now if I use the following...
Then due to precedence/usr/local/apache/htdocs/main is loaded. However, the subdomain is never recognized.
When I run httpd -S I get the following:
(server.domain.com is my WHM hostname)
How can I fix this?
Thank you!
I have a brand new WHM 11.46.0 (build 12) on a VPS. I only have a single IP on the VPS
My hostname is server.domain.com
I'm trying to get a subdomain working with a virtualhost, so that www.domain.com and sub.domain.com have different DocumentRoots.
Now, WHM autogenerated the following in httpd.conf:
Code:
NameVirtualHost 127.0.0.1:80
NameVirtualHost *
I added the following to the "Post VirtualHost" include file:
Code:
<VirtualHost *>
ServerName www.domain.com
ServerAlias www.domain.com
DocumentRoot "/usr/local/apache/htdocs/main"
</VirtualHost>
<VirtualHost *>
ServerName sub.domain.com
ServerAlias sub.domain.com
DocumentRoot "/usr/local/apache/htdocs/subdomain"
</VirtualHost>
If I put this in the "Pre VirtualHost" include file instead, it makes no difference.
Now if I use the following...
Code:
<VirtualHost 107.182.162.15:80 127.0.0.1:80>
When I run httpd -S I get the following:
Code:
107.182.162.15:80 www.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:1)
107.182.162.15:443 server.domain.com (/usr/local/apache/conf/httpd.conf:319)
127.0.0.1:80 is a NameVirtualHost
default server www.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:1)
port 80 namevhost www.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:1)
port 80 namevhost sub.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:8)
port 80 namevhost server.domain.com (/usr/local/apache/conf/httpd.conf:282)
127.0.0.1:443 server.domain.com (/usr/local/apache/conf/httpd.conf:319)
wildcard NameVirtualHosts and _default_ servers:
*:* is a NameVirtualHost
default server www.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:1)
port * namevhost www.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:1)
port * namevhost sub.domain.com (/usr/local/apache/conf/includes/pre_virtualhost_2.conf:8)
port * namevhost server.domain.com (/usr/local/apache/conf/httpd.conf:263)
How can I fix this?
Thank you!