Portal Home > Knowledgebase > Articles Database > Adding subdmain without control panel
Adding subdmain without control panel
Posted by four4, 11-16-2014, 12:38 PM |
How can I add subdomain to a server without control panel? Then I will add A record to my domain registrar to point it to my subdomain..
The web server is Apache.
|
Posted by BOXCWebsites, 11-16-2014, 01:01 PM |
I am thinking in the A Records, Point the A to your IP address and then name it to what the subdomain will be.
|
Posted by four4, 11-16-2014, 01:07 PM |
I already added virtual host..
But its redirecting on the path to serve instead of the subdomain..
|
Posted by TheSHosting, 11-17-2014, 12:15 AM |
Subdomain : abc.example.com
edit the dns zone of the domain example.com
example.com. 14400 IN A 192.168.2.1
abc 14400 IN A 192.168.2.1
(replace 192.168.2.1 with your IP)
save the dns file and exit.
backup httpd.conf file and edit the virtual host section
cp -a /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.backup
vi /etc/httpd/conf/httpd.conf
ServerName abc.example.com
ServerAlias www.abc.example.com
DocumentRoot /var/www/vhosts/example.com/abc/
save the apache conf file and exit.
check if there is any syntax error : httpd -t
Syntax OK
restart apache
|
Posted by madaboutlinux, 11-17-2014, 12:23 AM |
Which directory it is pointing to? Are you sure the DocumentRoot of the sub-domain is set to the correct directory and the IP there is the one you have set the A record to? Can you paste the VirtualHost entry and the sub-domain name?
|
Posted by four4, 11-17-2014, 01:13 AM |
This is the instructions that I followed..
http://rudkerssoftwarecorner.blogspo...ual-hosts.html
Is that correct?
|
Posted by rockgeeks, 11-17-2014, 02:25 AM |
Hello
It's actually very simple, we just need to configure two things, follow this guide for a very simple apache subdomain virtual host example:
Apache Virtual Host Configuration File
Your DNS settings
Setting up your Apache Virtual Hosts file for subdomains is very easy. In fact, you can pretty much copy and paste my config file, just change to your domain and point "DocumentRoot" to wherever you store your site files. If you have set up a virtual host on your server already, you will recognise the layout of the following apache subdomain virtual host example.
# Admin email, Server Name (domain name) and any aliases
ServerAdmin contact@example.com
ServerName dev.example.com
DocumentRoot /srv/www/example.com/dev/
# Custom log file locations
LogLevel warn
ErrorLog /srv/www/example.com/logs/dev.error.log
CustomLog /srv/www/example.com/logs/dev.access.log common
Depending on how who your domain is set up with, the actual way you change your DNS settings will vary, but the underlying principle to create subdomains with Apache Virtual Hosts is simple. Create a new "A Record" with the left side ("host name") set to "dev" and the right side pointing to your server's IP address.
Don't forget to reload Apache after setting up your virtual host subdomain (/etc/init.d/httpd restart or reload).
|
Posted by madaboutlinux, 11-17-2014, 08:26 AM |
Yes, it is but its quite lengthy compared to a small task and also there is no mention of A record in it. You should follow what "rockgeeks" has stated in his reply.
|
Add to Favourites Print this Article
Also Read
iTop10 Script (Views: 725)