Difference between revisions of "Hosting a website"

From Amahi Wiki
Jump to: navigation, search
m
(Oranization. Sorry for all the edits, still learning Wiki)
Line 1: Line 1:
 
*To access the HDA itself from outside the network using VPN, check out the [[Adito]] application, available to install through the HDA. Adito enables you to access the HDA, and all applications and folders, using just your free username.yourhda.com webaddress.
 
*To access the HDA itself from outside the network using VPN, check out the [[Adito]] application, available to install through the HDA. Adito enables you to access the HDA, and all applications and folders, using just your free username.yourhda.com webaddress.
  
You want to run a web server in your Amahi server and make it visible from the web outside your home.
+
So you want to run a web server in your Amahi server and make it visible from the web outside your home.
  
 
<div style="border: 1px solid #B66; padding: .5em 1em; color: #000; background-color: #FEE; margin: 3px 3px 1em 3px;">
 
<div style="border: 1px solid #B66; padding: .5em 1em; color: #000; background-color: #FEE; margin: 3px 3px 1em 3px;">
Line 7: Line 7:
 
</div>
 
</div>
  
With that out of the way, to host your own web site you need the following:
+
== Requirements ==
 +
 
 +
To host your own web site you need the following:
  
 
* Forward a port to your HDA ip address, either for plain insecure http: 80, for https, 443 (advanced users can use other ports). Some routers call this or require a "virtual server"
 
* Forward a port to your HDA ip address, either for plain insecure http: 80, for https, 443 (advanced users can use other ports). Some routers call this or require a "virtual server"
Line 13: Line 15:
 
* Chose the app you want to make accessible outside, let's say, '''yourwebappname'''
 
* Chose the app you want to make accessible outside, let's say, '''yourwebappname'''
  
What you need to do (as root) is find for apps conf file then edit the conf file for the app:
+
== Hosting a single Webapp ==
 +
 
 +
What you need to do (as root) is find the apps conf file then edit the conf file for the app:
 
      
 
      
 
     su
 
     su
Line 42: Line 46:
 
         ServerAlias username.yourhda.com
 
         ServerAlias username.yourhda.com
  
You can add more server aliases if you want to access the app under those names. Once you are satisfied with the server aliases, you may save and quit nano by following these steps in Windows:
+
You can add more server aliases if you want to access the app under those names (for example: ServerAlias myphotos.DomainName.com). Once you are satisfied with the server aliases, you may save and quit nano by following these steps in Windows:
  
 
     ctrl X
 
     ctrl X
Line 53: Line 57:
  
 
And you are done, enjoy your website.
 
And you are done, enjoy your website.
 +
 +
== Hosting multiple Webapps ==
  
 
''If you wish to have access to multiple webapps, described below is one way to accomplish this:''
 
''If you wish to have access to multiple webapps, described below is one way to accomplish this:''
Line 58: Line 64:
 
# obtain a domain name (i.e., via godaddy.com) --for example yourdomain.com
 
# obtain a domain name (i.e., via godaddy.com) --for example yourdomain.com
 
# for each web app you wish to have access to, establish a CNAME or subdomain--for example something.yourdomain.com---and point it to username.yourhda.com (for example see http://help.godaddy.com/article/679 )
 
# for each web app you wish to have access to, establish a CNAME or subdomain--for example something.yourdomain.com---and point it to username.yourhda.com (for example see http://help.godaddy.com/article/679 )
# edit the webapp .conf file to match the CNAME/subdomain you just established by adding ServerAlias something.yourdomain.com
+
# edit the webapp .conf file (see above) to match the CNAME/subdomain you just established by adding ServerAlias something.yourdomain.com
 
# don't forget to restart the server each time you edit a .conf file.
 
# don't forget to restart the server each time you edit a .conf file.
  
 
:#For example, you could create the subdomain/CNAME: address.yourdomain.com for the AddressBook webapp---point that subdomain to: username.yourhda.com---in the AddressBook .conf file add: ServerAlias address.yourdomain.com---restart the server---you are done, enjoy using multiple webapps!
 
:#For example, you could create the subdomain/CNAME: address.yourdomain.com for the AddressBook webapp---point that subdomain to: username.yourhda.com---in the AddressBook .conf file add: ServerAlias address.yourdomain.com---restart the server---you are done, enjoy using multiple webapps!
  
== FAQs ==
+
== FAQ ==
  
 
* Q: Do i need to do anything for <code>username.yourhda.com</code> to work?
 
* Q: Do i need to do anything for <code>username.yourhda.com</code> to work?

Revision as of 05:03, 19 November 2010

  • To access the HDA itself from outside the network using VPN, check out the Adito application, available to install through the HDA. Adito enables you to access the HDA, and all applications and folders, using just your free username.yourhda.com webaddress.

So you want to run a web server in your Amahi server and make it visible from the web outside your home.

NOTICE: making anything visible outside your network can open security issues, so you are doing this at your own risk. Some apps are more secure than others, but there is nothing ultimately secure. Best is to use the VPN to login back home."

Requirements

To host your own web site you need the following:

  • Forward a port to your HDA ip address, either for plain insecure http: 80, for https, 443 (advanced users can use other ports). Some routers call this or require a "virtual server"
  • Chose a domain name that you own (or your free username.yourhda.com that comes with Amahi). This is how the app will be accessed outside
  • Chose the app you want to make accessible outside, let's say, yourwebappname

Hosting a single Webapp

What you need to do (as root) is find the apps conf file then edit the conf file for the app:

    su
    [enter password]
    ls /etc/httpd/conf.d

Find your app .conf file. It will look like 10##-yourwebappname.conf

    nano /etc/httpd/conf.d/10##-yourwebappname.conf

Your conf file should look something like this at the top of the page:

<VirtualHost *:80>

       ServerName app
       ServerAlias app.YourDomain.lan

Add this (immediately after the ServerName directive):

    ServerAlias username.yourhda.com

So it looks like this:

<VirtualHost *:80>

       ServerName app
       ServerAlias app.YourDomain.lan
       ServerAlias username.yourhda.com

You can add more server aliases if you want to access the app under those names (for example: ServerAlias myphotos.DomainName.com). Once you are satisfied with the server aliases, you may save and quit nano by following these steps in Windows:

    ctrl X
    At the prompt, type "y" to save
    At the prompt, hit "Enter" to save the file

Restart the server using:

    service httpd reload

And you are done, enjoy your website.

Hosting multiple Webapps

If you wish to have access to multiple webapps, described below is one way to accomplish this:

  1. obtain a domain name (i.e., via godaddy.com) --for example yourdomain.com
  2. for each web app you wish to have access to, establish a CNAME or subdomain--for example something.yourdomain.com---and point it to username.yourhda.com (for example see http://help.godaddy.com/article/679 )
  3. edit the webapp .conf file (see above) to match the CNAME/subdomain you just established by adding ServerAlias something.yourdomain.com
  4. don't forget to restart the server each time you edit a .conf file.
  1. For example, you could create the subdomain/CNAME: address.yourdomain.com for the AddressBook webapp---point that subdomain to: username.yourhda.com---in the AddressBook .conf file add: ServerAlias address.yourdomain.com---restart the server---you are done, enjoy using multiple webapps!

FAQ

  • Q: Do i need to do anything for username.yourhda.com to work?
     No. That comes free and automatically set up with your Amahi HDA
  • Q: What if i want to do it for a .html or .php file?
     You can do this by creating a Webapp of your own. In the apps tab,
     select Webapps and create a new one.
     What you do is, create a web app, and put the files into the root
     directory of the webap, something like this directory:
         /var/hda/web-apps/yourwebappname/html
     this directory belongs to apache. you will have to change the
     ownership to your user (recommended) or otherwise add things as root.
  • Q: How do I change the ownership?
     You can do this by going to the command screen:
        su -
        {password}
        chown {user} /var/hda/web-apps/