Changes

From Amahi Wiki
Jump to: navigation, search
1,671 bytes added ,  23:52, 19 April 2015
ls /etc/httpd/conf.d
 :: '''NOTE:''' If you get a message like ''"ls: cannot access /etc/httpd/conf.d: No such file or directory"'', simply use the following to manually change directories: cd /etc cd /httpd cd /conf.d
ls
nano /etc/httpd/conf.d/10##-yourwebappname.conf
 :: '''NOTE:''' Depending on the options you chose during installation, you may not have the "nano" text editor installed. If that is the case, you will receive an error message. Instead, substitute "vi" for "nano" to use a different text editor. [http://www.cs.colostate.edu/helpdocs/vi.html Here are the commands to use the "vi" editor.]
Your conf file should look something like this at the top of the page:
= Hosting Multiple Webapps =
''If you wish to have access to multiple webapps, described below is one way to accomplish this('''NOTE:''' ''Requires a dnynamic DNS provider in addition to Amahi username.yourhda.com''):
# obtain a domain name (i.e., via godaddy.com) --for example yourdomain.com
# 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!
Even if you have a dynamic IP address from your ISP, this can still be done - rather inexpensively. Some [http://en.wikipedia.org/wiki/Dynamic_DNS dynamic DNS] services, like DynDNS, allow for you to create a domain and use something called a [http://en.wikipedia.org/wiki/Wildcard_DNS_record wildcard DNS record]. This acts much like the subdomain created above, but you can literally use anything you want so long as the server is set to answer to the request. Below, we'll outline the basic steps needed to accomplish this.
## At the time of this writing, DynDNS is calling it their ''Pro'' account.
## Basic accounts will not allow you to use wildcards.
# In your Amahi's web-GUI, navigate to your [[Media:Amahi-webapps.PNG|Webapps]] section via '''Apps > Webapps''' (amahi 6Ubuntu). The Amahi [https://www.amahi.org/apps/web-apps Web App] provides this functionality in Amahi 7.
# In our case, we'll be allowing our Dokuwiki to answer to our wildcard DNS record so expand it by clicking on it.
## This will show several options to edit but we're only going to add an '''alias'''.
You can see that adding that ServerAlias added the line: '''ServerAlias wiki.tommy.homedns.org'''
 
= Hosting Webapps (Change Port)=
This is an alternate method for hosting single or multiple web apps using the builtin Amahi dynamic DNS (''username.yourhda.com''). This will likely work with other dynamic DNS providers.
 
You can change the port that most web apps operate, specifically port 80. You can use any port not already in use by the OS or your HDA. To verify what ports are already in use, do (as ''root'' user):
nmap -sT -O localhost
 
Once you have chosen the port to use, follow the steps below (using [https://www.amahi.org/apps/adminer Adminer] as an example and port 8081):
 
* Edit ''/etc/httpd/conf.d/####-adminer.conf'' and add the following line. Also change 80 to 8081 in the VirtualHost line:
Listen 8081
<VirtualHost *:8081>
* Update the ServerAlias:
ServerAlias adminer.amahi.net:8081
* Add right below ServerAlias to use the Amahi dynamic DNS:
ServerAlias username.yourhda.com:8081
* Restart web server:
systemctl restart httpd
 
Forward port 8081 on the router of course to access from outside the network. Anytime you access the app on your network internally, navigate to <nowiki>http://adminer.amahi.net:8081</nowiki>.
 
:'''NOTE:''' ''amahi.net'' part of the URL may be different depending on the domain you use for your HDA.
 
To change the app back to using port 80, remove the ''Listen'' line and change the port to ''80'' in ''/etc/httpd/conf.d/####-adminer.conf''.
 
I would not recommend you try this with apps that do not use port 80. For example, an application that uses the web server proxy will most certianly not work with this method.
= Hosting a Website =
12,424

edits