Difference between revisions of "Host a static site on Dubsdot"

From CSLabsWiki
Jump to: navigation, search
(Initial Tutorial for hosting a static site.)
Line 1: Line 1:
 
This is a tutorial on how to take a static HTML website and host it on our webserver, [[DubsDot]]
 
This is a tutorial on how to take a static HTML website and host it on our webserver, [[DubsDot]]
 
TODO
 
  
 
=Directory=
 
=Directory=
 +
First, a folder needs to be created on DubsDot for all of your files to be located in. By default, this should be in <code>/var/www/</code>. Then, place all relevant files into the directory. The directory and all contents need to be both the user and group of www-data. This should be the requirements for setting up all files needed
  
 
=VirtualHost=
 
=VirtualHost=
 +
 +
Next is setting up the config file for a virtual host. in /etc/apache2/sites-available/, create a foobar.conf where foobar is the name of the subdomain. The template for the config file is below
 +
 +
<pre>
 +
<VirtualHost *:80>
 +
        ServerName foobar.cslabs.clarkson.edu
 +
        ServerAlias foobar.cosi.clarkson.edu
 +
        ServerAlias foobar
 +
        DocumentRoot /var/www/foobar
 +
        <Directory /var/www/testing>
 +
                Order allow,deny
 +
                Allow from all
 +
        </Directory>
 +
</VirtualHost>
 +
</pre>
 +
 +
Then run <code>a2ensite foobar</code> and apache should be hosting the site now.
  
 
=DNS=
 
=DNS=
  
 +
The final step is to set up DNS so one can navigate to the website. ssh into [[Talos]] and in the /etc/bind/db.cosi and /etc/bind/db.cslabs files,
 +
add the line under the CNAME section.
 +
 +
<pre>
 +
foobar IN CNAME dubsdot
 +
</pre>
 +
 +
As with usual DNS, increment the serial number at the top of the document and reload it with <code>rndc reload</code>. If everything works out, you can go to the domain specified and the page should be up.
  
 
[[Category:How-Tos]]
 
[[Category:How-Tos]]

Revision as of 20:32, 29 January 2016

This is a tutorial on how to take a static HTML website and host it on our webserver, DubsDot

Directory

First, a folder needs to be created on DubsDot for all of your files to be located in. By default, this should be in /var/www/. Then, place all relevant files into the directory. The directory and all contents need to be both the user and group of www-data. This should be the requirements for setting up all files needed

VirtualHost

Next is setting up the config file for a virtual host. in /etc/apache2/sites-available/, create a foobar.conf where foobar is the name of the subdomain. The template for the config file is below

<VirtualHost *:80>
        ServerName foobar.cslabs.clarkson.edu
        ServerAlias foobar.cosi.clarkson.edu
        ServerAlias foobar
        DocumentRoot /var/www/foobar
        <Directory /var/www/testing>
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

Then run a2ensite foobar and apache should be hosting the site now.

DNS

The final step is to set up DNS so one can navigate to the website. ssh into Talos and in the /etc/bind/db.cosi and /etc/bind/db.cslabs files, add the line under the CNAME section.

foobar			IN CNAME	dubsdot

As with usual DNS, increment the serial number at the top of the document and reload it with rndc reload. If everything works out, you can go to the domain specified and the page should be up.