6 Replies - 6877 Views - Last Post: 23 July 2018 - 10:23 PM

#1 Albusx   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 19-June 17

How to add subdomain without cPanel

Posted 19 June 2017 - 12:14 PM

Hello, I am trying to understand how to create a subdomain without having a cPanel at all. The website is hosted in a personal server which is not using cPanel. Can anyone advise me how can I make them as I've never encountered such a task. I have 2 landing pages for which I have to create 2 subdomains. Thank you.
Is This A Good Question/Topic? 0
  • +

Replies To: How to add subdomain without cPanel

#2 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2413
  • View blog
  • Posts: 7,384
  • Joined: 15-January 14

Re: How to add subdomain without cPanel

Posted 19 June 2017 - 01:41 PM

The process differs based on which web server you're using. If you do a search for the web server name along with "create subdomain" or something similar, you should find some documentation.
Was This Post Helpful? 0
  • +
  • -

#3 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6823
  • View blog
  • Posts: 31,461
  • Joined: 10-May 07

Re: How to add subdomain without cPanel

Posted 21 June 2017 - 09:10 PM

it's relatively easy, until you get into the details:

1.) setup dns, point your subdomain at an ip address
2.) configure your webserver to answer for requests to this subdomain
3.) write code for loading content for the subdomain
Was This Post Helpful? 0
  • +
  • -

#4 unisecureus   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-May 18

Re: How to add subdomain without cPanel

Posted 19 July 2018 - 03:13 AM

A sub-domain is normally set-up not by adding a folder but by changing the records where the domain is registered. A folder can be like www.domain.com/folder-name a subdomain would be subdomainname.domain.com Ordinarily there are a bunch of tools to set this up with the domain registrant and it will have a field for the IP address of the sever. which will be the same one as the main site.
Was This Post Helpful? 0
  • +
  • -

#5 Arenlor   User is offline

  • D.I.C Regular
  • member icon

Reputation: 38
  • View blog
  • Posts: 427
  • Joined: 26-April 06

Re: How to add subdomain without cPanel

Posted 19 July 2018 - 10:22 AM

I run bind myself, it's not too hard. We do need to know your setup though to actually be able to answer this question.
Bind:
game    IN  A   208.79.95.136
game    IN  AAAA    2607:f2f8:3180::8

Apache:
<VirtualHost 208.79.95.136:80>
    ServerName game.arenlor.com
    Redirect permanent / https://game.arenlor.com/
</VirtualHost>
<VirtualHost [2607:f2f8:3180::8]:80>
    ServerName game.arenlor.com
    Redirect permanent / https://game.arenlor.com/
</VirtualHost>
<VirtualHost 208.79.95.136:443>
    ServerName game.arenlor.com
    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/arenlor.com/cert.pem"
    SSLCertificateChainFile "/etc/letsencrypt/live/arenlor.com/chain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/arenlor.com/privkey.pem"
    DocumentRoot /srv/http/arenlor/game
</VirtualHost>
<VirtualHost [2607:f2f8:3180::8]:443>
    ServerName game.arenlor.com
    SSLEngine on
    SSLCertificateFile "/etc/letsencrypt/live/arenlor.com/cert.pem"
    SSLCertificateChainFile "/etc/letsencrypt/live/arenlor.com/chain.pem"
    SSLCertificateKeyFile "/etc/letsencrypt/live/arenlor.com/privkey.pem"
    DocumentRoot /srv/http/arenlor/game
</VirtualHost>


You can see I use letsencrypt (with certbot) for my SSL, free, easy. I recommend everyone just do it. Those files of course contain more info, but I'm presuming you already have a base domain going and just want to add a subdomain. It should help you if you're running bind and apache though.
Was This Post Helpful? 2
  • +
  • -

#6 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2413
  • View blog
  • Posts: 7,384
  • Joined: 15-January 14

Re: How to add subdomain without cPanel

Posted 19 July 2018 - 11:12 AM

Just FYI, this topic is over a year old and it's unlikely that the OP would see new responses, although it's fine to post useful information.
Was This Post Helpful? 0
  • +
  • -

#7 HostechSupport   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 18-July 18

Re: How to add subdomain without cPanel

Posted 23 July 2018 - 10:23 PM

We have to take x1.mysite.com for example:

at the command line
you can change this for your own needs
type in
mkdir -p /var/www/vhost/x1.mysite.com/htdocs
mkdir -p /var/www/vhost/x1.mysite.com/logs
mkdir -p /var/www/vhost/x1.mysite.com/cgi-bin

mkdir -p /var/www/vhost/x2.mysite.com/htdocs
mkdir -p /var/www/vhost/x2.mysite.com/logs
mkdir -p /var/www/vhost/x2.mysite.com/cgi-bin

==== centos / redhat / fedora ====
chown -R apache:apache /var/www/vhost
OR
=== deb / Ubuntu ====
chown -R www-data:www-data /var/www/vhost


chmod -R 775 /var/www/vhost

(you may want to check the chmod levels there )

i know mainly where the redhat and its clones keep the apache conf files
so you may need to look around for the deb and its clone apache files


open this file and add to the bottom of it the command than quite and save

vi /etc/httpd/conf/httpd.conf

NameVirtualHost *.80


<VirutalHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/vhost/x1.mysite.com
ServerName x1.mysite.com
ServerAlias www.x1.mysite.com
ErrorLog /var/www/vhost/x1.mysite.com/logs/error_log
CustomLog /var/www/vhost/x1.mysite.com/logs/access_log common
ScriptAlias /cgi-bin/ /var/www/vhost/x1.mysite.com/cgi-bin/
</VirutalHost>

<VirutalHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/vhost/x2.mysite.com
ServerName x2.mysite.com
ServerAlias www.x2.mysite.com
ErrorLog /var/www/vhost/x2.mysite.com/logs/error_log
CustomLog /var/www/vhost/x2.mysite.com/logs/access_log common
ScriptAlias /cgi-bin/ /var/www/vhost/x2.mysite.com/cgi-bin/
</VirutalHost>

save and quit

then you get access to them to update your DNS server records
or edit the host's files on your system that u will be trying to access the sites from and add

<IP_OF_WWW_BOX> x1.mysite.com x2.mysite.com

save it
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1