How to run Play Application on Apache 2 server? - apache

I'm completely new to this, so please forgive me.
What I have right now is a Play application that, when I run play run on my personal Mac the site launches on localhost:9000 and everything works fine.
I also have a server running CentOS that tells me to "add content to the directory /var/www/html/" when I navigate to it's IP, but I don't understand how I can do that with a Play application? It's not like I have a bunch of HTML files I can just put there?
So my question is, what steps do I need to take to make it so if I go to the IP of my server, it takes me to the website I made and that is currently stored on my Mac?

You need to configure Apache as a "proxy" to your Play application (that's why you won't need to put anything into /var/www/html/).
Your application code can be uploaded anywhere you want on the server. It will need to be started on the server (with play start for example) and Apache will "forward" requests to the running Play application.
You can look at the Play documentation in the "Deploy your application" section :
"Deploying your application" (general recommandations) : https://www.playframework.com/documentation/2.6.x/Production
"Set-up a front-end HTTP server" (explain how to deploy Play behind Apache or Nginx) : https://www.playframework.com/documentation/2.6.x/HTTPServer

Related

Can't use phone ase controller

I want to test my airconsole game on a smartphone before publishing. The problem is, I can't connect it to the simulator.
If i try to connect (Chrome on Android) it says connecting, after a few seconds it shows the enter code screen but no input is possible. After about 30 seconds I get the message download the app for next time. (Screenshots attached)
Do you know where the problem is?
My files are hosted on a webserver, accessible from everywhere.
Kind regards
Make sure your screen.html and controller.html are accessible from all devices.
Let's assume you are running your local web server on http://192.168.0.2:8080/
Try to access http://192.168.0.2:8080/screen.html and http://192.168.0.2:8080/controller.html using a normal web browser on the device that doesn't work. It should display the screen/controller html.
If you can't access http://192.168.0.2:8080/controller.html from your phone, but from your computer, make sure you are in the same network and that your router does not have "Client Isolation" activated.
If you are testing with real smartphones, make sure you do not use http://localhost/ or http://127.0.0.1/, because localhost is not your computer on the phone but the phone itself!
If you are still unable to connect your phone, you can use the ngrok tool to forward your local url. See our Ngrok Unity Guide for how to do this in the Unity Engine: https://developers.airconsole.com/#!/guides/unity-ngrok

How to run Php Pages in Netbeans

I have just successfully deployed Quercus on Glassfish 4.1. I tested in the browser
http://localhost:8080/quercus-4.0.39/ and saw this:
Congratulations! Quercus™ Open Source 4.0.39 is interpreting PHP
pages. Have fun!
Then ran Netbeans Tools > Options > PHP > Activate PHP Support
It worked. I now see this:
So I made 3 tests:
I ran a php page in an html application but instead of displaying the page it prompts a download box to open in Notepad
I created a new PHP project with below configuration:
But when I run the app with above configuration I receive this error:
Firefox can't establish a connection to the server at localhost.
So I tried with a third test with other configuration:
When I run this third test I get a HTTP Status 404 - Not Found error on GlassFish server.
What am I doing wrong? Thank you!
The problems with your tests are:
PHP needs to be interpreted by a web server. Your browser doesn't know what to do with a PHP file, so it just treats it like a file rather than a page to render. Apache is the most common and easiest server to do that with, GlassFish is unnecessary and probably not the best choice for PHP.
In this test, you are trying to visit a web server which doesn't exist. You don't have any server that listens on port 80.
Here, GlassFish is reporting that it can't find the resource you requested. Have you made sure to put your PHP project in the right directory for Quercus (like in step 4 of your documentation link) and made sure you're visiting a valid URL?
I think the best thing for you to do is move away from Quercus. The latest version of it is very old and implements an old version of PHP (version 5, whereas the latest is 5.6). Looking at the official website, the project appears to be dead, with broken links and very old documentation.
I would suggest you investigate installing a WAMP (Windows, Apache, MySQL, PHP) or LAMP (Linux, Apache, MySQL, PHP) stack. There are lots of very easy installers for this approach which will help you get up to speed and a lot of helpful tutorials and documentation.
For those who using tomcat, below are the steps :-
Right click your project --> properties --> Run Configuration --> For Run As, select PHP Built-in Web Server
Go to Tools --> Options --> PHP tab --> in Php 5 interpreter, browse the correct location for php
Then it should works !
In my case , my php is in /usr/bin/php7.0, so I put the path in Php 5 interpreter.

Apache Tomcat Server shutdown yet webapplication is still running

I am using Apache Tomcat 6.0.18, I am running on Windows XP
I have a web application which I place it's war file under webapps folder. The web application runs fine, its just when I run the shutdown.bat the application still runs (as in I refresh the page and it doesn't come up not found).
I check the localhost:/8080 and webpage cannot be found comes up
but when I run localhost:/8080/myapp my application comes up.
I have tried this in both IE and Firefox
Thank you for any help.
I had this similar problem, This can only happen if Apache Tomcat is not configured properly. Best way is to check build path and look for exact directory of Apache.
Example
i.e C:\Program Files (x86)\apache-tomcat-7.0.27
Also look for windows service for start, restart or stop
Run - services.msc
You may want to check this link
i.e
Verify that tomcat is actually down (simplest way is via task manager)
The issue sounds like a caching issue. Try deleting your cache.

How to automatically test if offline mode is working in web application

I have mobile web application that has offline capabilities (via HTML5).
I'm currently building automatic build & testing for it (ant, JsTestDriver etc.), until I hit a wall. How can I test if the web application has working offline mode? This is specially painful since if tested by hand; iPhone practically needs full reset between tests (it tends to cling on to some parts of the data).
I'm thinking something around these lines (on a idea level):
Setup Java web server with ant
Fire some sort of headless client, that supports HTML5 offline use
Load the application
Validate that everything is loaded
Disable server
Load the application
Validate that everything is loaded, still
Any suggestions how would I proceed doing something like this?
Not sure I understand your question, but what do you think of:
Not using an iPhone, but chrome on PC with the ripple emulator http://ripple.tinyhippos.com/
Setting a fake proxy or editing the .host file in order to be sure that your chrome session does not have access to your server.

Developing and Testing a Facebook application

Typically I develop my websites on trunk, then merge changes to a testing branch where they are put on a 'beta' website, and then finally they are merged onto a live branch and put onto the live website.
With a Facebook application things are a bit tricky. As you can't view a Facebook application through a normal web browser (it has to go through the Facebook servers) you can't easily give each developer their own version of the website to work with and test.
I have not come across anything about the best way to develop and test a Facebook application while continuing to have a stable live website that users can use. My question is this, what is the best practice for organising the development and testing of a Facebook application?
Try updating your hosts file (for windows users # c:\windows\System32\Drivers\etc\hosts) with an entry that will route all requests from your live domain back to your machine.
So 127.0.0.1 mywebappthatusesfacebook.com.
Then make sure that your app is running at the root of your webserver. # http://localhost/ Then goto mywebappthatusesfacebook.com in your browser and it should redirect right back to your local machine. Facebook won't know the difference. Hope this helps
The way I and my partner did it was we each made our own private Facebook applications, that pointed to our IP address where we worked on it. Since we worked in the same place, we each picked a different port, and had our router forward that port to our local IP address. It was kinda slow to refresh a page, but it worked very nicely.
You'll have to add both trunk and test versions as different applications and test them using test accounts. You may also use a single application and switch its target URL between cycles.
Testing FB apps is still a rather primitive process.
I generally setup a test application that is a complete copy of the production settings inside the FB development environment that uses an SSH tunnel to point to my development server. You can setup as many applications as you need inside FB - I generally have a development application, a staging app and production. Staging and Production are both on "live" servers rather than an SSH tunnel.
In your application you then use whatever language/framework/server tools are at your disposal to switch the FB configuration based on the server. In Rails, the Facebooker gem actually has built in support for different FB configurations.
Once all of that is done, testing is, unfortunately, still a matter of running the app within FB itself. I use Selenium to automate as much of this as possible.
Best way to do this:
Remove 'App Domain' from 'Basic Info'
Set website's 'Site URL' to : "http://localhost/" .
That simple.
(This only apply if you don't have a live system running in parallel to the test env. In that case get yourself another key.)
We have it setup much like Toby. A series of config files for each developer, that has the Facebook APP Id info (a different app for each developer), separate pages where the app is hosted, and git ignores the config files. We're LAMP with Code Igniter, and it's similar to Rails in that we can set the environment in 1 file, which points to the config with the Facebook constants.
Branching out into Selenium, using unit tests for model-testing.
For local testing we simply use a different app than for the server. In our case the Canvas-URL is set to localhost.local:8000.
You only have to make sure that when you use facebook connect that you type in localhost.local into the address field of the browser and not just localhost.
For testing a canvas or tab app it is faster if you use the 'open iframe in new tab' command of Firefox. This way the session and cookies from Facebook are preserved.
Another solution is NGROK
https://ngrok.com/
It opens a public tunnel to your local app
Example on my rails application by simply typing
./ngrok 3000
I get
http://630066fe.ngrok.com -> 127.0.0.1:3000