Advanced APE configuration

saniel edited this page Aug 1, 2013 · 1 revision

Contents

There are two different ways to use the APE Server on a dedicated server:

  • APE is used on a server where it gets along with another web server (See : How to configure the APE Server with another web server)
  • APE has his own dedicated IP in order to use port 80 (See : How to configure the APE Server on port 80)

Configure APE server

How to configure the APE Server with another web server

If you are using APE in tandem with a web server which is already bound on port 80 (such as Apache), you don't have to edit anything. APE is configured to run on port 6969 by default.

You can jump to Run your APE Server.

How to configure the APE Server on port 80

To make the APE Server work on a dedicated IP through port 80, you just need to edit the ape.conf file (./bin) as the following:

# ./bin/ape.conf
 
Server {
	port = 80               # The port of APE - Here 80 with the use of a dedicated IP for the APE Server.
	daemon = no             # if "yes", launches APE in background 
	ip_listen = <ip to bind APE>     
	domain = auto
	rlimit_nofile = 10000
}

Configure your server/computer

In order to use APE features like multi-tabbing or windowing your domain name must be specially configured. Whether you're setting APE up as a server or configuring for local access consult the correct section below for details on what needs to be done.

If you use APE on a server

You need to:

Create a subdomain pointing to the server where APE is installed. For example, the subdomain of yourdomain.com is ape.yourdomain.com Create a Catch-All CNAME redirecting all requests from *.ape.yourdomain.com to ape.yourdomain.com

Edit your DNS configuration.

If you use bind9 add those line to your zone file:

ape     IN    A        x.x.x.x  ; The IP address of your APE server
*.ape   IN    CNAME    ape

If you use APE on your local computer

Edit your /etc/host file and add the following lines...

/etc/hosts:

127.0.0.1 ape-test.local
127.0.0.1 ape.ape-test.local
127.0.0.1 0.ape.ape-test.local
127.0.0.1 1.ape.ape-test.local
127.0.0.1 2.ape.ape-test.local
127.0.0.1 3.ape.ape-test.local
127.0.0.1 4.ape.ape-test.local
127.0.0.1 5.ape.ape-test.local
127.0.0.1 6.ape.ape-test.local
127.0.0.1 7.ape.ape-test.local
127.0.0.1 8.ape.ape-test.local
127.0.0.1 9.ape.ape-test.local

If you are running APE on Windows in a virtual machine, edit the file C:\WINDOWS\system32\drivers\etc\hosts

To access across two LAN-connected computers this same method of setting the hosts file entries correctly works without needing to set the DNS entries. This results in a locally accessible server which is not visible from outside but is visible inside but acts just as though it would if it were accessed remotely. This is ideal for tests which require controlled access.

To do this, edit the server hosts file in the same way as above. On any viewing LAN computer, add the following lines onto their own hosts file...

(Assuming the server's internal IP were 192.168.1.100) /etc/hosts:

192.168.1.100 ape-test.local
192.168.1.100 ape.ape-test.local
192.168.1.100 0.ape.ape-test.local
192.168.1.100 1.ape.ape-test.local
192.168.1.100 2.ape.ape-test.local
192.168.1.100 3.ape.ape-test.local
192.168.1.100 4.ape.ape-test.local
192.168.1.100 5.ape.ape-test.local
192.168.1.100 6.ape.ape-test.local
192.168.1.100 7.ape.ape-test.local
192.168.1.100 8.ape.ape-test.local
192.168.1.100 9.ape.ape-test.local

This makes it so the same URL may be entered to test locally on the server, or on any networked computer so configured.

Again, this works for Windows machines viewing a Linux server. Just edit the Windows hosts file - again, located at C:\WINDOWS\system32\drivers\etc\hosts - as stated above on the viewing computer. Do not use localhost for your domain or any domain without TLD or your APE installation will not work!

Run your APE Server

You can now run your APE Server. To run the APE Server : :

If you installed APE from source simply go to the /bin/ folder and launch :

APE:~/APE_Server/bin/# ./aped

If you use a Debian package, your APE server is already launched; you have to restart it to make a configuration change.

APE:~# /etc/init.d/ape-server restart

If you installed the APE Server through a RPM package you have to launch APE and specify the config file:

APE:~# /usr/bin/aped --cfg /etc/ape/ape.conf

Alternatively, if you followed the instructions for adding the RPM-installed APE as a daemon, you can stop then start the service:

APE:~# service aped stop
APE:~# service aped start

In theory, restarting should work just as well, but an error may occur such that the daemon either may not start, or may appear not to have started. In this case, to check whether the service is running, enter one of the following commands:

APE:~# ps faux | grep aped

If aped is running, this command will show the grep aped command process and the one for the APE daemon; if not, it will show only the grep aped process information.

APE:~# pgrep aped

APE:~# pidof aped

If running, either of the last two commands will return only the process id of the aped process; if you get a process id, then you know the APE Server is running.

In any case, if the server isn't running, simply enter (as root):

APE:~# service aped start

That's it! The APE Server is now ready to be used! :)

If for some reason your APE Server does not start, you might want to check this page : APE server does not start

Install APE JSF

At this point, we assume your APE server is now configured. It's time to setup the APE JavaScript Framework and check that your APE server is working. If you're using IIS to serve the JSF framework don't forget to add these lines to your web.config (thank you AddeBC):

<system.webServer>
	<handlers>
		<add name="js" path="*.js" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\System32\inetsrv\asp.dll" resourceType="Unspecified" preCondition="bitness64" />
	</handlers>
</system.webServer>

Adding a Server Alias in Your Apache Configuration

Add to your VirtualHost the following lines:

ServerAlias ape.yourdomain.com
ServerAlias *.ape.yourdomain.com

Or create a new VirtualHost entry:

<VirtualHost *>
        Servername yourdomain.com
        ServerAlias ape.yourdomain.com
        ServerAlias *.ape.yourdomain.com
 
        DocumentRoot "/directory/of/your/choice/"
</VirtualHost>

Configuring APE JSF

Put all APE JSF files in the directory you just specified in your VirtualHost entry (/directory/of/your/choice/) above.

Then, open the file Demos/config.js. Configure it as follows:

// To test, go to http://yourdomain.com/APE_JSF/Tools/Check/
APE.Config.baseUrl = 'http://yourdomain.com/APE_JSF'; //APE JSF 
APE.Config.domain = 'yourdomain.com'; //Your domain, must be same as domain in aped.conf
APE.Config.server = 'ape.yourdomain.com:6969'; //APE server URL

Note that "yourdomain.com" is used without a "www" subdomain, specifically not "www.yourdomain.com", in these entries.

If you use APE on your local machine, replace "yourdomain.com" with "ape-test.local", like:

// To test, go to http://ape-test.local/APE_JSF/Tools/Check/
APE.Config.baseUrl = 'http://ape-test.local/APE_JSF'; //APE JSF 
APE.Config.domain = 'ape-test.local'; // /etc/hosts domain, must be same as domain in aped.conf
APE.Config.server = 'ape.ape-test.local:6969'; //APE server URL

Note the subdomain "ape" being located under the domain "ape-test.local" under the APE.Config.server entry.

The default port installed in the RPM installation is port 6969, and the APE JavaScript Framework separate download is packed as ape-jsf, so the following code may be more worthwhile:

// To test, go to http://ape-test.local/ape-jsf/Tools/Check/
APE.Config.baseUrl = 'http://ape-test.local/ape-jsf'; //APE JSF 
APE.Config.domain = 'ape-test.local'; // /etc/hosts domain, must be same as domain in aped.conf
APE.Config.server = 'ape.ape-test.local:6969'; //APE server URL

This is a good example of how you may need to tweak your installation to get it to work how you want it to.

Note that 6969 is just used in case the user starting the server is not root. If installed as a service implicitly run by root, then port 443 is a much better port to put it on. To do this, simply replace all occurrences of 6969 with 443 and ensure nothing is already running on port 443, then restart the aped daemon.

Test your installation

Now, if you open your browser to:

http://yourdomain.com/APE_JSF/Tools/Check/

or, depending on your installation:

http://ape-test.local/ape-jsf/Tools/Check/

you should see a page offering to test your installation. Naturally, seeing this page at all is a basic test of your installation. Beyond that, if you press the green "Launch Test!" button, this tool will perform some check and verify your APE server is correctly set up and help you to find what is going wrong if it is not.

At this point, if your installation is not yet working, check this page: APE_Server_does_not_start for server errors, JSF_Check_Tool_Error_Messages_Explained for APE JSF help or come on our IRC channel #ape-project@irc.freenode.net or use our groups

What next?

Now you can try the APE demo, hack it and read some APE Tutorials. Let your imagination do cool things :) Retrieved from "http://www.ape-project.org/wiki/index.php/Advanced_APE_configuration"