webserver

pbecks1963
Posts: 51
Joined: Fri Dec 12, 2008 12:24 am
Location: Netherlands/Zutphen

webserver

Postby pbecks1963 » Fri Jan 09, 2009 4:42 am

Hello,

I want to place an index.html (webpages) somewhere on the Amahi-server and be able to watch these pages remotely.

-Where do i put the html/doc's ?
-Whats's my url to view these pages..?
-Do i need to activate something on the server?

(ps: my router/firewall is NON pingable so nobody can ping my external ip-address, could that become a problem?)

User avatar
cpg
Administrator
Posts: 2618
Joined: Wed Dec 03, 2008 7:40 am
Contact:

Re: webserver

Postby cpg » Fri Jan 09, 2009 4:51 am

create a web app, and give it the name you want, say myapp.

for the root dir choose the default (for now).

create the webapp.

put your html as index.html in the root dir.

http://myapp should be accesible now and your index.html file should be what you see.

for accessing the web app remotely, please use the VPN to connect back to your network.
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 8GB RAM, 1TBx2+3TBx1

pbecks1963
Posts: 51
Joined: Fri Dec 12, 2008 12:24 am
Location: Netherlands/Zutphen

Re: webserver

Postby pbecks1963 » Fri Jan 09, 2009 5:09 am

Hello,

So a public website is not possible? (visable to the whole world who do not have the vpn-connection)

User avatar
cpg
Administrator
Posts: 2618
Joined: Wed Dec 03, 2008 7:40 am
Contact:

Re: webserver

Postby cpg » Fri Jan 09, 2009 5:19 am

it is possible, just not something that is supported out of the box.

it's fraught with risks. if the application is not 100% secure, you have a problem of someone getting right on to your machine.

at the moment it has to be done "by hand".

we plan to make options in the future to:

- password protect an app (this is already in the alpha code)
- make an app the default one, so that forwarding the port 80 or 443 will just work
- support https support for apps

i don't know if anyone who has done it wants to document it here. otherwise you can come by the IRC channel and we can help out there to do all this by hand.
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 8GB RAM, 1TBx2+3TBx1

User avatar
jfrenc14
Expert
Posts: 55
Joined: Wed Dec 03, 2008 8:13 pm

Re: webserver

Postby jfrenc14 » Fri Jan 09, 2009 9:40 pm

here will be the quick and dirty way.

This quick guide will assume you want https to add a bit of security, this will add htpasswd or htaccess which i strongly suggest that you do

1) go to /etc/httpd/conf.d/ and edit the web app you have installed to make it look like this

Code: Select all

VirtualHost *:443> ServerName whateveryouwantittobecalled ServerAlias username.yourhda.com SSLEngine On SSLCertificateFile /etc/httpd/conf/filename.crt SSLCertificateKeyFile /etc/httpd/conf/filename.key DocumentRoot /var/hda/web-apps/[put docuement root here] <Directory "/var/hda/web-apps/[put document root here]"> Options Indexes FollowSymLinks +ExecCGI AddHandler fcgid-script .fcg AllowOverride AuthConfig Order allow,deny Allow from all AuthType Basic AuthName "[any name you want]" AuthUserFile "/var/hda/.htpasswd" Require valid-user php_value post_max_size 10M php_value upload_max_filesize 10M </Directory> </VirtualHost>
2) the redirect script that redirects 80 to 443, put this in teh same directory as the above and all it like 10-redirect.conf

Code: Select all

<VirtualHost *:80> ServerName username.yourhda.com RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] ExpiresDefault "access plus 10 years" AddOutputFilterByType DEFLATE text/html text/plain text/xml </VirtualHost>
3)go to /etc/httpd/conf/
4)create a crt and key in teh directry

Code: Select all

openssl genrsa -out filename.key 1024 then

Code: Select all

openssl req -new -key filename.key -x509 -days 1000 -out filename.crt
Note make sure that the common name is username.yourhda.com

5)run

Code: Select all

yum -y install mod_ssl
6)add

Code: Select all

NameVirtualHost *:443
any where in the file /etc/httpd/conf/httpd.conf
7)next create the file .htpasswd in /var/hda/
8)go to http://www.htaccesstools.com/htpasswd-generator/ create a username and passwd to access you site
9)copy that and paste it into the .htpasswd
10)go to you DirectoryRoot and create a robots.txt and paste this in it

Code: Select all

User-agent: * Disallow: /
This will block google bots and other bots from going on your website and posting on google and etc
11) run

Code: Select all

service httpd restart
Now i Think taht was all you need to do. if not let me knwo

User avatar
relrobber
Posts: 72
Joined: Wed Dec 17, 2008 10:01 pm
Location: Searcy, AR
Contact:

Re: webserver

Postby relrobber » Sun Jan 11, 2009 9:57 pm

the quick and easy (read: non-secure) way to access your page from the internet is to fwd port 80 to your HDA. then log in to amahi.org to get your ddns address.
Home HDA: Sony VAIO PCV-RX560, 1.7GHz P4, 320MB RAM

Managed HDA: 512MB RAM

pbecks1963
Posts: 51
Joined: Fri Dec 12, 2008 12:24 am
Location: Netherlands/Zutphen

Re: webserver

Postby pbecks1963 » Mon Jan 12, 2009 1:25 am

Hello jfrenc14,

I did all you suggested. Some questions:

Do i need to forward port 443 to my hda (server) in my firewall/router?
What will be the url to get to my webpage? (use the fake example data please)
*****************************************************************************
Fake example: my url: fakenick.yourhda.com
Fake external IP: 123.23.4.5
Fake webapp: Mywebpage
Fake directory root: /var/hda/web-apps/Mywebpage
ip hda-server (internal): 192.168.1.12
ip router/firewall: 192.168.1.1
*****************************************************************************
ps: before i started to execute your instructions i made an Web Apps (with Amahi setup) and in that directory i placed a simple "index.html"-file.

When i go now to http://Mywebpage, i end up in the Amahi Setup page. (the url has changed into: http://hda/hda_app_Mywebpage)

? (do i need to reboot the server?)

ps2: i was working remotely (freenx) on the amhiserver but now i am getting "connection error's (can't connect to the server) I hope that is has nothing to do with the changes i just made?? I did however just lost internet connection in the network that i work in (at work) but when the internet came back online i still couldn't make a freenx connection home.

User avatar
jfrenc14
Expert
Posts: 55
Joined: Wed Dec 03, 2008 8:13 pm

Re: webserver

Postby jfrenc14 » Mon Jan 12, 2009 1:20 pm

To answer your questions



Do i need to forward port 443 to my hda (server) in my firewall/router?
yes you have to do that, I would suggest only port fowarding 443, if you do just 443 then you have to do https:// before the site.

What will be the url to get to my webpage? (use the fake example data please)
*****************************************************************************
Fake example: my url: fakenick.yourhda.com
Fake external IP: 123.23.4.5
Fake webapp: Mywebpage
Fake directory root: /var/hda/web-apps/Mywebpage
ip hda-server (internal): 192.168.1.12
ip router/firewall: 192.168.1.1
*****************************************************************************

to get to the site (if port 443 is the only one enabled) then it would be https://fakenick.yourhda.com

When i go now to http://Mywebpage, i end up in the Amahi Setup page. (the url has changed into: http://hda/hda_app_Mywebpage)

? (do i need to reboot the server?)

no need to reboot amahi, just do the command

Code: Select all

su -c 'service httpd restart'
that will restart the web server. I could be wrong but the reason you can just do http://site is becuase we have changed the ServerAlias, you should be able to get to it by ip address just as your 192.168.1.12

ps2: i was working remotely (freenx) on the amhiserver but now i am getting "connection error's (can't connect to the server) I hope that is has nothing to do with the changes i just made?? I did however just lost internet connection in the network that i work in (at work) but when the internet came back online i still couldn't make a freenx connection home.
It should not messing with freenx at all. once in a while i'll get conenction errors dont really know why, All I know about freenx is how to set it up

pbecks1963
Posts: 51
Joined: Fri Dec 12, 2008 12:24 am
Location: Netherlands/Zutphen

Re: webserver

Postby pbecks1963 » Tue Jan 13, 2009 1:12 am

Hello,

I still can't find my webpage. I forwared 443 to my hda (tried udp & tcp).

?

User avatar
jfrenc14
Expert
Posts: 55
Joined: Wed Dec 03, 2008 8:13 pm

Re: webserver

Postby jfrenc14 » Tue Jan 13, 2009 2:52 pm

ok can you ping it? post the results for 'https -S' also if you enter the ip address https://ip does it come up? are you tying to access from wan or lan? have you restarted teh server?

Who is online

Users browsing this forum: No registered users and 33 guests