-
Notifications
You must be signed in to change notification settings - Fork 16
Behind HTTP Server
Even though Amforeas provides an easy way to publish a web-app, you might want to only use its webservices and provide access to your application by an HTTP server. This setup will be very important for your AJAX applications to be able to communicate with Amforeas.
We are going to assume that you're running Amforeas and your HTTP server in the same machine, although this is not mandatory as you will see later.
- Set the
amforeas.server.port
and theamforeas.server.host
environment variables to whatever fits you (i.e. localhost, 8080) - Set up your database configuration
- Start Amforeas
Try doing a request directly to test everything is working fine:
curl "http://server:8080/amforeas/stats"
$ a2enmod mod_proxy
$ a2enmod mod_proxy_http
We will create a new virtual host for our application called demo so we can access it with the url http://www.server.com/demo/
with the following configuration:
<VirtualHost *:80>
ServerName www.server.com
RewriteEngine on
RedirectMatch ^/$ /demo/
ProxyPass /amforeas/ http://localhost:8080/amforeas/
ProxyPassReverse /amforeas/ http://localhost:8080/amforeas/
DocumentRoot /srv/www/htdocs/docroot
CustomLog /var/log/apache2/access_reports combined
ErrorLog /var/log/apache2/error_reports
</VirtualHost>
This should give you a quick start. The magic here is to allow AJAX requests to be made against the relative path /amforeas/foo
to our web server, and it will proxy this requests to Amforeas. This way we don't have to worry about breaking our AJAX calls or using JSONP.