Configuring a virtual host
Shiver me timbers!
I would like to have a special documentroot for just one domain and I am wondering if I am going about it correctly.
In /usr/local/apache/conf/extra/ I found this interesting file, httpd-vhosts.conf.
I am hosting several domains. All except one will have the default documentroot.
Is this all I need to have?
[QUOTE]
NameVirtualHost *:80
# VirtualHost example:
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/local/apache/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias
If my domain name is domain.com with the document root in /home/evan/public_html/wordpress would the httpd-vhosts.conf look like this? [QUOTE] NameVirtualHost *:80 # VirtualHost example: ServerAdmin webmaster@domain.com DocumentRoot "/home/evan/public_html/wordpress" ServerName evan.com ServerAlias http://www.domain.com ErrorLog "" CustomLog "some other path here" common
How would I let apache know that I am using virtual hosts? Also, if something goes wrong and I want to disable virtual hosting because the httpd-vhosts.conf is incorrect how would I let apache know to ignore the erroneous httpd-vhosts.conf file? Thanks!
If my domain name is domain.com with the document root in /home/evan/public_html/wordpress would the httpd-vhosts.conf look like this? [QUOTE] NameVirtualHost *:80 # VirtualHost example: ServerAdmin webmaster@domain.com DocumentRoot "/home/evan/public_html/wordpress" ServerName evan.com ServerAlias http://www.domain.com ErrorLog "" CustomLog "some other path here" common
How would I let apache know that I am using virtual hosts? Also, if something goes wrong and I want to disable virtual hosting because the httpd-vhosts.conf is incorrect how would I let apache know to ignore the erroneous httpd-vhosts.conf file? Thanks!
-
I looked in httpd.conf and there is a virtual host included for every domain. If I were to include a httpd-vhosts.conf that would override the cpanel's entry I am guessing that I would include it AFTER the cpanel's generated entry in httpd.conf? 0 -
After adding a virtual host the documentroot is not served properly. httpd restarts without errors. NameVirtualHost *:80 ServerAdmin DocumentRoot "/home//public_html/wordpress" ServerName ServerAlias www. ErrorLog "/usr/local/apache/logs/a-name_log" CustomLog "/usr/local/apache/logs/a-name-access_log" common When I go to domain name it does not shows me the contents of the documentroot path, instead, I get the contents of the domain name, which is a list of directories. 0 -
Thanks, quietFinn. Fixed! 0 -
Hello :) I am happy to hear the solution in that post was able to help you. Thank you for letting us know the issue is resolved. 0 -
@Anuj Kushwaha - you may not have the level of access necessary to perform that work if you only have cPanel access and not root access to the system. The modern installation guide can be found here, so I'd recommend reviewing that and seeing if your server meets the requirements: How to Install a Node.js Application | cPanel & WHM Documentation but there are things in there that require root access to the system. 0
Please sign in to leave a comment.
Comments
7 comments