Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: subdomains

  1. #1
    Join Date
    Mar 2014
    Beans
    7

    subdomains

    Alright so I've searched and can't seem to find an answer.

    I was wondering if I was going to use a subdomain do I have to have all the files in the www directory or can I use other directories? If so how?

    example 1:
    wordpress.domain.com /var/www/wordpress/
    wiki.domain.com /var/www/wiki/
    domain.com /var/www/

    example 2:
    /var/wordpress/
    /var/wiki/
    /var/www/

    Also is there any guides I can use to install both a wiki and wordpress? And is there a way to auto-backup my site every x days?

  2. #2
    Join Date
    Jun 2007
    Location
    Waikikamukau, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: subdomains

    You don't have to have all your files sitting in the /var/www directory. One option is be to use virtualhosts.

    I'm calling it a night; if you have further questions, someone else might be able to step in.
    Forum DOs and DON'Ts
    Never assume that information you find using a search engine is up-to-date.

  3. #3
    Join Date
    Mar 2014
    Beans
    7

    Re: subdomains

    Thanks,
    I did try the apache2 thing. It didn't work. Do I need to change something in my 'netfirms' account to set up the subdomains or can it all be done via ubuntu?

    Also I was just playing around and it seems like my links show the ipaddress rather then the domain
    e.g. www.domain.com with a link to /files/abc.html
    it shows 111.222.333.444/files/abc.html instead of domain.com/files/abc.html (the url itself does not change however in the browser url bar it stays domain.com)

    I also cannot access any subdirectories by typing domain.com/files/abc.html, if gives me a page not found but using the ip instead works.

    In netfirms I'm pointing to my ip address in stealth mode. Not sure if thats what I'm suppose to do.

  4. #4
    Join Date
    Nov 2006
    Location
    Vienna, Austria
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: subdomains

    Have you checked what you have listed under ServerName under /etc/apache2/sites-available/* ?

  5. #5
    Join Date
    Sep 2006
    Beans
    7,916
    Distro
    Lubuntu Development Release

    Apache2 virtual hosts

    Each subdomain needs its own virtual host configuration. They go under /etc/apache2/sites-available/ with one file per vhost. What you are looking to do is set up name-based virtual hosts. Remember that each new vhost needs to be enabled (a2ensite) before it can actually be used. That only needs to be done once. When you make changes to the vhost configurations, for the changes to take effect. That has to be done any time you make changes.

    As to where they go, I'd consider a variant of example 1:

    wordpress.domain.com /var/www/wordpress/
    wiki.domain.com /var/www/wiki/
    domain.com /var/www/domain/
    The Truth Shall Make Ye Fret.

  6. #6
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    9,508
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: subdomains

    Have you read this part of the Ubuntu Server Guide? How about this and this from the Apache documentation?
    If you ask for help, please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  7. #7
    Join Date
    Mar 2014
    Beans
    7

    Re: subdomains

    Yes I have done those things (enabled using a2ensite and have reloaded). Perhaps my vhost is wrong
    this is what I have right now for the wordpress one (I have activated it). I get forbidden when I try it. wordpress.domain.com.

    <VirtualHost *:80>
    ServerName wordpress.domain.com
    ServerAlias wordpress.domain.com
    DocumentRoot /var/wordpress
    </VirtualHost>
    <Directory /var/wordpress/>
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>
    My Default is this

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    Last edited by mrteach12; March 31st, 2014 at 09:28 PM.

  8. #8
    Join Date
    Mar 2014
    Beans
    7

    Re: subdomains

    I did try changing the default to the wordpress directory and it worked (www.domain.com) went to the wordpress directory. I changed it back.

    I'm thinking it might be something with my domain... This was my first domain purchase, but I am assuming all I need to do from the domain purchase site is point it to the ip of my host?

    I'm wondering why the links show up as [ip]/images/hello.jpg instead of www.domain.com/images/hello.jpg

  9. #9
    Join Date
    Mar 2014
    Beans
    7

    Re: subdomains

    Seems like default is handling all the connections if I try asfasd.domain.com it uses the default and not my wordpress [site-avaliable] (vhost)

  10. #10
    Join Date
    Oct 2009
    Beans
    127
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: subdomains

    Hello, Bellow is my notes that I have on my forums when I need to create sub-domains Feel free to take a look on your own. Click Here

    Hope this helps!!!

    sub-domains is a good way to organize your website. example.com is what we will call the parent domain. You could have many different parts to your website. For example you could have forums, books, music, really anything. so instead of having all your components to your website lay in the same directory /var/www you could go a step further and organize it. Here is an example of how you could structure /var/www using sub-domains


    /var/www/example.com { Main domain }
    /var/www/forums { forums }
    /var/www/music {if you have a music site or streaming}
    /var/www/books { digital books site}



    By using this type of structure to set up sub-domains all your website components eg: forums, music, books wont have to all be in the root directory of the website. Do you like www.example.com/forums? or would you rather see forums.example.com?

    Here is how we accomplish this.

    We need to navigate to
    cd /etc/apache2/sites-available/


    Now we are going to create our sub-domain file.
    sudo nano forums.example.com



    We will use a virtual host here is what it will look like.
    <VirtualHost *:80>
    ServerName forums.example.com
    ServerAlias www.forums.example.com
    DocumentRoot /var/www/forums/
    </VirtualHost>
    <Directory /var/www/forums/>
    Options -Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    </Directory>



    Next we will need to enable the site with apache2.
    sudo a2ensite forums.example.com


    Now we need to reload apache for the changes to take place.
    sudo /etc/init.d/apache2 reload

    Now all you need to do is create a folder in /var/www called forums eg; /var/www/forums

    In order for you to be able to access the forums.example.com you will need to modify DNS and add an A record. You Can go to the registar where you got the domain and register the sub-domain and point it to your server, you could use a third party dns such as zoneedit to handle all your dns needs for your domain

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •