Upload
appserverio
View
367
Download
1
Embed Size (px)
Citation preview
InhaltsverzeichnisMy First WebApp...............................................................................................................2
Prerequisite....................................................................................................................2Preparations...................................................................................................................2Hello-World Script.........................................................................................................3Hello-World Servlet.......................................................................................................4Using Services...............................................................................................................6Annotations! But why?..................................................................................................7Okay, folks that is all!....................................................................................................8
Building WebApps with AngularJS and appserver.io.........................................................9Prerequisite....................................................................................................................9Preparations.................................................................................................................10Login Form..................................................................................................................13Frontend Authentication..............................................................................................15RESTful Service..........................................................................................................18Input Validation............................................................................................................24Done!...........................................................................................................................27
Running TYPO3 6.2 LTS.................................................................................................28Installation...............................................................................................................29
Additional Infos..................................................................................................30Installing with Virtual Host.....................................................................................30
Running Magento.............................................................................................................32Installation...................................................................................................................33Securing your Installation............................................................................................40Adding Rewrites..........................................................................................................46Virtual Host Configuration..........................................................................................47Rotating Logfiles.........................................................................................................48Executing Magento CRON Jobs..................................................................................49Summary......................................................................................................................53
Running Wordpress..........................................................................................................54Installation:..................................................................................................................55
Running TYPO3 Neos......................................................................................................57Installation:..................................................................................................................58
Running Drupal................................................................................................................60Installation:..................................................................................................................61
Installing with Virtual Host.....................................................................................62Running phpMyAdmin.....................................................................................................63
Installation:..................................................................................................................64Running Joomla................................................................................................................65
Installation:..................................................................................................................66Installing with Virtual Host.....................................................................................67
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
My First WebApp
This tutorial explains how to implement your first webapp on appserver.io from
scratch using the Servlet-Engine mixed with Dependency Injection and
Session-Bean integration.
PrerequisiteFirst you will need a running installation of appserver.io (>= Version 1.0.0-rc3). If
you are new to this project you can easily download and follow the installation guide
for your specific OS.
PreparationsAt first switch to dev mode in our local appserver.io installation. This will set the
correct filesystem permissions for your user account and also let the appserver
process itself run as the current user. This will make it easy for local development.
sudo /opt/appserver/server.php -s dev# Should return: Setup for mode 'dev' done successfully!
Now you are ready to create the webapp called myapp
# Goto appserver.io webapps folder
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
cd /opt/appserver/webapps/
# Create myappmkdir myapp
# Go into myappcd myapp
# Open it with your favorite editor if you want to...pstorm .brackets .atom .
Keep the webapp under version control from the early beginning, so that you
always have a chance to rollback things and maybe push it finally to GitHub with all
the history in it if you want to.
git init
# Some default git ignore stuffecho ".idea\n/vendor\ncomposer.lock" > .gitignore
# Do initial commitgit add .git commit -m "initial commit"
Hello-World ScriptThe simplest way to echo things like Hello-World to the client is the way you
already know. Using a simple PHP script. So check if that works in appserver and
create a PHP script called hello.php directly in the webapps folder
/opt/appserver/webapps/myapp.
<?php echo "hello i'am a simple php script"; ?>
Open the browser at [http://127.0.0.1:9080/myapp/hello.php] and you should
get...
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Wooow it works... looks great :)
# Commit the current state via git.git add .git commit -m "added hello-world script"
Hello-World ServletOk now do the same thing using the Servlet-Engine by creating your first simple
Hello-World Servlet. In the beginning create the WEB-INF/classes folder where all
Servlets are. In this folder the namespaces and classes MUST follow an autoloading
PSR: PSR-0.
PSR-4 support is comming in one of the next appserver.io releases.
If our vendor name is MyVendor the folder should look like WEB-
INF/classes/MyVendor/MyApp
mkdir -p WEB-INF/classes/MyVendor/MyApp
Finally we introduce our servlet by creating a PHP class file called
HelloServlet.php in that folder.
<?php
namespace MyVendor\MyApp;
use AppserverIo\Psr\Servlet\Http\HttpServlet;
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
/** * @Route(name="helloWorld", urlPattern={"/hello.do", "/hello.do*"}) */class HelloServlet extends HttpServlet{ public function doGet($servletRequest, $servletResponse) { $servletResponse->appendBodyStream("hello i'am a simple servlet"); }}
Due to the reason that servlets are pre-initialised by the servlet-engine at the
appserver.io startup it is necessary to restart the appserver every time it is needed
to test the recent changes. Here is a short overview how to restart.
# OSXsudo /opt/appserver/sbin/appserverctl restart
# Debian / Ubuntu / CentOSsudo /etc/init.d/appserver restart
# Fedorasudo systemctl restart appserver
After the appserver has restarted goto [http://127.0.0.1:9080/myapp/hello.do]
and you should get...
Strike! :)
# Commit the current state via git.git add .git commit -m "added hello-world servlet"
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Using ServicesAs the most business logic should be separated into services now implement a
simple HelloService which is getting inject into the HelloServlet via Dependency-
Injection. To use Dependency-Injection you have to put the service classes at META-
INF/classes where the namespaces and classes MUST also follow an *autoloading
PSR: PSR-0.
mkdir -p META-INF/classes/MyVendor/MyApp
Let us introduce the HelloService which provides the getHelloMessage()
method that returns the hello-world message that the servlet should serve to the
client. Create a PHP class file called HelloService.php in folder META-
INF/classes/MyVendor/MyApp
<?php
namespace MyVendor\MyApp;
/** * @Stateless */class HelloService{ public function getHelloMessage() { return "hello i'am a simple servlet with service usage"; }}
To inject the HelloService into the HelloServlet add an annotated property
$helloService and modify the doGet method to make use of the injected service
instance. The HelloServlet should now look like this...
<?php
namespace MyVendor\MyApp;
use AppserverIo\Psr\Servlet\Http\HttpServlet;
/** * @Route(name="helloWorld", urlPattern={"/hello.do", "/hello.do*"}) */
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
class HelloServlet extends HttpServlet{ /** * @EnterpriseBean(name="HelloService") */ protected $helloService;
public function doGet($servletRequest, $servletResponse) { $servletResponse->appendBodyStream( $this->helloService->getHelloMessage() ); }}
Restart the appserver again and refresh the browser at
[http://127.0.0.1:9080/myapp/hello.do]. Here you go...
And here it is... Your First WebApp on appserver.io!
# Commit the current state via git.git add .git commit -m "added hello-world service and enhanced servlet"
Feel free to enhance it and let us know what you have built upon the next PHP infrastructure!
Annotations! But why?To use servlets without configuration, it is necessary to add a @Route annotation
so the servlet-engine is able to map a specific url to the servlet.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
<?php/** * @Route(name="helloWorld", urlPattern={"/hello.do", "/hello.do*"}) */ class HelloServlet extends HttpServlet
This annotation maps the URL http://127.0.0.1:9080/myapp/hello.do and
http://127.0.0.1:9080/myapp/hello.do/anything/you/want to the servlet. For
more servelt details checkout out Servlet Engine section in our Documentation
You also use annotations to use Dependency-Injection. To make our HelloService
injectable add an annotation above the class definition. In this case we want to have
a stateless Session-Bean so put @Stateless to class doc block.
<?php/** * @Stateless */class HelloService
To inject our HelloService to the HelloServlet via Property-Injection we just
have to put the annotation above the member property like this...
<?phpclass HelloServlet extends HttpServlet{ /** * @EnterpriseBean(name="HelloService") */ protected $helloService;
Okay, folks that is all!We hope this tutorial helps you to have a smooth start into the world of
appserver.io webapps!
Any feedback is appreciated so do not hesitate to share your experiences or any
problems you encounter with us. Cheers! :)
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Building WebApps with AngularJS and appserver.io
This tutorial shows how to build a webapp using AngularJS as a single page app in
the frontend and appserver.io as a RESTful service in the backend using Servlets,
Dependency-Injection, AOP and Annotated-Validation.
PrerequisiteYour system should be well prepared for Javascript, HTML, and CSS/SASS
development. We will generate an AngularJS app using Yeoman, that allows to
kickstart an AngularJS app, prescribing best practices and tools to help you stay
productive* So please check out and follow the Instructions at Yeoman guide to
setup your system correctly.
You will need a running installation of appserver.io (>= Version 1.0.1). If you are
new to this project you can easily download and follow the installation guide for your
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
specific OS.
PreparationsAt first switch your local appserver.io installation to dev mode. This will set the
correct filesystem permissions for your user account and also let the appserver
process itself run as a current user that makes it a lot easier for local development.
sudo /opt/appserver/server.php -s dev# Should return: Setup for mode 'dev' done successfully!
Now you are ready to create our webapp called myapp
# Goto **appserver.io** webapps foldercd /opt/appserver/webapps/
# Create myappmkdir myapp
# Go into myappcd myapp
# Open it with your favorite editor if you want to by doing...pstorm .wstorm .brackets .atom .
To start the AngularJS app via Yeoman, you need the correct yeoman generator
installed globally first.
sudo npm install -g generator-angular
Start your AngularJS app right under our webapp folder
/opt/appserver/webapps/myapp. Decide if you want to use Sass or include
Bootstrap. Just hit enter for default values.
yo angular# Hit enter for any questions
Before you can open our webapp in the browser please add some Virtual-Hosts to
the appserver configuration. Do so by opening
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
/opt/appserver/et/conf.d/virtual-hosts.xml with your favorite editor and add
this:
<virtualHost name="myapp.dist"> <params> <param name="documentRoot" type="string">webapps/myapp/dist</param> </params></virtualHost>
<virtualHost name="myapp.dev"> <params> <param name="documentRoot" type="string">webapps/myapp</param> </params> <rewrites> <rewrite condition="-f{OR}.*\.do.*" target="" flag="L" /> <rewrite condition="^/(.*\.css)$" target="/.tmp/$1" flag="L" /> <rewrite condition="^/(.*)$" target="/app/$1" flag="L" /> </rewrites></virtualHost>
Add those hostnames to your /etc/hosts file to associate it with your local IP
address.
127.0.0.1 myapp.dev myapp.dist::1 myapp.dev myapp.dist
Now restart the appserver and build the kickstarted AngularJS app by just calling
grunt in our webapps folder /opt/appserver/webapps/myapp
# OSXsudo /opt/appserver/sbin/appserverctl restart
# Debian / Ubuntu / CentOSsudo /etc/init.d/appserver restart
# Fedorasudo systemctl restart appserver
cd /opt/appserver/webapps/myappgrunt
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Open [http://myapp.dist:9080] in your browser and it should look like this.
Does it look awesome... :)
If you use grunt or the similar grunt build command, grunt will build the app
into a subdirectory called dist, where everything has been optimized
(concatenated, uglified etc...) for production usage.
For local development, it is highly recommended to use the grunt watch
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
command that observes all the javascript app files and builds it automatically. If
anything has been changed without uglifing or doing other optimizations, so you are
still able to debug your app. That is the reason why we configured the Virtual-Host
myapp.dev, where you can reach the debuggable version of your javascript app. So
let's try it by typing...
grunt watch
Open [http://myapp.dev:9080] in your browser and it should look like as shown
above in the dist screenshot.
Cool... everything is fine! Ready for take off? :)
Login FormNow enhance the AngularJS app by adding a login form that will make use of an
Authentication-Service on the backend side, which we'll implement later on. First
step is to create a new route login vi Yeoman by doing:
yo angular:route login
This creates a controller including its view template and adds the route
configuration to your app which can be found under app/scripts/app.js. Now
we've to add a link to the new login route at the app navigation by editing the
app/index.html file. Find the line where it's says <ul class="nav navbar-nav">
and add a new <li> element as last one:
<li><a ng-href="#/login">Login</a></li>
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Refresh your browser at [http://myapp.dev:9080] and click on the new login
navigation element.
Cool... the route is reachable. Now add a login form by editing the login template
located in app/views/login.html.
<form name="loginForm" ng-controller="LoginCtrl" ng-submit="login(credentials)" novalidate> <h2 class="form-signin-heading">Please sign in</h2> <label for="username" class="sr-only">Username</label> <input type="text" id="username" class="form-control" placeholder="Username" required="" autofocus="" ng-model="credentials.username"> <label for="password" class="sr-only">Password</label> <input type="password" id="password" class="form-control" placeholder="Password" required="" ng-model="credentials.password"> <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button> <p><br/></p></form>
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Refresh your browser and click on the Login Button located at the navigation.
For being able to submit the login form, you will need a backend as well as a
frontend implementation of an AuthService.
Frontend AuthenticationLet us start building a simple AuthService in AngularJS by kickstarting the
service easily via Yeoman...
yo angular:service AuthService
This generates the service implementation file
app/scripts/services/authservice.js and adds it automatically to the script
includes section of app/index.html. Open the service file and edit it:
angular.module('myappApp') .service('AuthService', function ($http, Session) { var login = function (credentials) { return $http .post('/login.do', credentials)
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
.then(function (res) { Session.create(res.data.id, res.data.username); return res.data.username; }); }; var isAuthenticated = function () { return !!Session.id; }; return { login: login, isAuthenticated: isAuthenticated }; });
As we are using a Session singleton object here in the login method to keep the
user’s session information, we have to kickstart it via Yeoman too:
yo angular:service Session
Just open that generated Session singleton located at
app/scripts/services/session.js and add simple functionality like create and
destroy as shown below:
angular.module('myappApp') .service('Session', function () { this.create = function (id, username) { this.id = id; this.username = username; }; this.destroy = function () { this.id = null; this.username = null; }; return this; });
To make use of our simple AuthService we have to inject it in the login controller
and add the login method to the scope which is used by the login form via ng-
submit="login(credentials)". So, open app/scripts/controllers/login.js
and add let it look like...
angular.module('myappApp') .controller('LoginCtrl', function ($scope, $location, AuthService) { $scope.credentials = { username: '',
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
password: '' }; $scope.login = function (credentials) { AuthService.login(credentials).then(function (username) { $scope.setErrorMessage(null); $scope.setCurrentUsername(username); $location.path('/'); }, function (response) { $scope.setErrorMessage(response.data.error.message); }); }; });
For any global application logic like $scope.setCurrentUsername(username); or
to know if someone is authenticated and has a Session-Id we need to create another
controller called app. Create it with yeoman...
yo angular:controller app
... and add some global functionality to it app/scripts/controllers/app.js
angular.module('myappApp') .controller('AppCtrl', function ($scope, AuthService) { $scope.currentUser = null; $scope.isAuthenticated = AuthService.isAuthenticated; $scope.setErrorMessage = function (message) { $scope.errorMessage = message; }; $scope.setCurrentUsername = function (username) { $scope.currentUsername = username; }; });
Finally we want something to be happen if the user has authenticated. First let's
hide the Login navigation element by opening app/index.html where we added the
login button at the beginning and modify it this way.
<li ng-if="!isAuthenticated()"><a ng-href="#/login">Login</a></li>
It would be nice if the current username will be present at top top navigation as
well, so just get into app/index.html again add a welcome paragraph just before
the <ul class="nav navbar-nav">.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
...<p ng-if="isAuthenticated()" class="navbar-text"> <span class="welcome">Logged in as <b></b></span></p>
All error messages should also be displayed. In app/index.html search for <div
ng-view=""></div> and add this before and right after the main container div <div
class="container">...
<div ng-if="errorMessage" class="alert alert-danger alert-error"> <span class="close" ng-click="setErrorMessage(null)">×</span> <strong>Error!</strong><div ng-bind-html="errorMessage"></div></div>
Until we can test our frontend auth mechanism we have to implement the
backend AuthService as well.
If you want to get more information about authentication techniques in AngularJS applications just check out this Link where you can find a collection of ideas for authentication and access control.
RESTful ServiceHere is where the appserver comes into place. Make use of the Servlet-Engine
and Dependency-Injection as we did in the My First WebApp for providing as
Service-Oriented architecture. Also take advantage of AOP for the need of building a
RESTful service api based on json format to keep it solid.
Start implementing the AuthService by creating it META-
INF/classes/MyVendor/MyApp/AuthService.php and implement some simple auth
functionality with hardcoded valid credentials, which can of course easily be
replaced using a CredentialProvider if you want to enhance the tutorial later on.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
<?php
namespace MyVendor\MyApp;
/** * @Stateless * @Processing("exception") */class AuthService{ protected $credentials = array( 'admin' => 'admin', 'user' => 'pass', 'guest' => 'guest' ); protected $username; protected $password;
protected function setUsername($username) { $this->username = $username; }
protected function setPassword($password) { $this->password = $password; }
protected function auth() { if (isset($this->credentials[$this->username]) && ($this->credentials[$this->username] === $this->password)) { return $this->username; } throw new \Exception('Username or Password invalid', 401); }
public function login($credentials) { $this->setUsername($credentials->username); $this->setPassword($credentials->password); return $this->auth(); }}
Now a Servlet WEB-INF/classes/MyVendor/MyApp/LoginServlet.php is needed
which listens to http://myapp.dev:9080/login.do where our AngularJS app
AuthService is connected to. Inject the AuthService and implement the doPost
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
method since there will only be credentials sent via HTTP-Post Method.
<?php
namespace MyVendor\MyApp;
use AppserverIo\Psr\Servlet\Http\HttpServlet;use AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface;use AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface;
/** * @Route(name="login", urlPattern={"/login.do", "/login.do*"}, initParams={}) */class LoginServlet extends HttpServlet{ /** * @EnterpriseBean(name="AuthService") */ protected $authService;
/** * @param HttpServletRequestInterface $servletRequest * @param HttpServletResponseInterface $servletResponse */ public function doPost( HttpServletRequestInterface $servletRequest, HttpServletResponseInterface $servletResponse ) { $username = $this->authService->login($this->data); $session = $servletRequest->getSession(true); $session->start();
return array( 'id' => $session->getId(), 'username' => $username ); }}
Ok, looks good... but how does it work without json_encode the returned array
and where is the $this->data property created from? This can easily be done by
using one of the powerful features the appserver comes with. It's called AOP or
Aspect-oriented programming. Just click on the link if you are not familiar with it.
All we have to do is to introduce an JsonHandlingAspect class which is
annotated with @Aspect and registers a pointcut triggered by do*() methods like
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
doGet() or doPost() for all Servlet-Classes found in the \MyVendor\MyApp
namespace. This pointcut will be used by an Around-Advices which wraps around the
actual method logic.
For our JsonHandlingAspect example we will validate the requests body content
if it can be decoded by using the json_decode function and set the decoded json
object in the data property of the servlet instance. The actual return value of the
servlets do* methods will be automatically encoded to valid json strings via
json_encode and appended to the response body stream. The same will happen if
an exception is thrown in any service business logic used by the servlet with the
addition that the response status code is filled with the code provided by the
exception and it's message is sent via an error json format.
Do so by creating META-
INF/classes/MyVendor/MyApp/JsonHandlingAspect.php and implementing it
with...
<?php
namespace MyVendor\MyApp;
use AppserverIo\Psr\MetaobjectProtocol\Aop\MethodInvocationInterface;
/** * @Aspect */class JsonHandlingAspect{ /** * @Pointcut("call(\MyVendor\MyApp\*Servlet->do*())") */ public function allServletDoMethods() {}
/** * @Around("pointcut(allServletDoMethods())") */ public function jsonHandlingAdvice(MethodInvocationInterface $methodInvocation) { // get servlet method params to local refs $parameters = $methodInvocation->getParameters(); $servletRequest = $parameters['servletRequest']; $servletResponse = $parameters['servletResponse'];
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
// try to handle request processing try { // only if request has valid json if (!is_object(json_decode($servletRequest->getBodyContent()))) { throw new \Exception('Invalid request format', 400); } // set json parsed object into data property of servlet object $methodInvocation->getContext()->data = json_decode( $servletRequest->getBodyContent() ); // call orig function $responseJsonObject = $methodInvocation->proceed(); } catch(\Exception $e) { $servletResponse->setStatusCode( $e->getCode() ? $e->getCode() : 400 ); // create error json response object $responseJsonObject = new \stdClass(); $responseJsonObject->error = new \stdClass(); $responseJsonObject->error->message = nl2br($e->getMessage()); } // add json encoded string to response body stream $servletResponse->appendBodyStream(json_encode($responseJsonObject)); }}
I hope the inline comments are good enough to understand whats going on. You
may also checkout our AOP Documentation Section if you want to get more details
about AOP within the appserver.
Let's give it a try if that works! :) Restart the appserver and do a browser-refresh
at [http://myapp.dev:9080].
If the browser can not connect to the appserver you better check any appserver log files which are located at /opt/appserver/var/log for any errors.
You should see the app still unchanged if everything went fine. Now just click the
Login Button and sign in using any valid credentials like admin/admin, guest/guest
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
or user/pass.
If the Login Button has disappeared and a welcome paragraph is showing Logged
in as {username} everything works as expected! Please also check if invalid
credentials will bring up the error message box.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Input ValidationImagine if you could easily add input validation of client-side form data via
annotation using the most awesome validation engine ever created for PHP
Respect\Validation... Sounds great? Works great! :)
Let's say we wanna validate that the username field value of your login form is
not an email address format and the password field value is not allowed to be empty.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
All we have to do is add the following annotations to the setUsername and
setPassword methods of our AuthService and introduce
Respect\Validation\Validator as v via use-statement.
<?php...use Respect\Validation\Validator as v;... /** * @Requires(type="RespectValidation", constraint="v::not(v::email()->setName('Username'))->check($username)") */ protected function setUsername($username) { $this->username = $username; }
/** * @Requires(type="RespectValidation", constraint="v::notEmpty()->setName('Password')->check($password)") */ protected function setPassword($password) { $this->password = $password; }
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Restart the appserver and check it out...
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Done!We hope you enjoyed this tutorial, and it helps for a quick overview how easy it is
to create a RESTful service backend by using great features like Servlets,
Dependency-Injection, AOP and Annotated-Validation that appserver provides
out of the box. Even when there is no need to use a specific framework as the
appserver is not only a powerful PHP infrastructure, but also a fully featured
enterprise solution for PHP.
Every feedback is appreciated so please do not hesitate to share experiences or
any issue you may encounter with us. Cheers! :)
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running TYPO3 6.2 LTS
Appserver.io is a pretty cool and sophiscated infrastructure fully built upon the
PHP stack. This makes it truely easy to develop and extend the platform.
Appserver.io comes with an built in webserver module with PHP-FPM therefore it is
possible to install any PHP-App you like and run it on that platform. The following
guide shows you how easy it is to install appserver.io on a Mac and run TYPO3 6.2 on
it.
Prerequisite: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of this unbelivable platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation
Download the latest TYPO3 Release from typo3.org.
To install TYPO3 we have now two options. The easiest way is to install TYPO3
without creating a vhost. Therefore you just unpack the TYPO3 source into your
Webrootfolder which in case of the appserver is always the webapps folder
underneath /opt/appserver/webapps/. In that folder you will still find the already
installed example app and of course the welcome page. We are just creating a folder
with name „newtypo3“
cd /opt/appserver/webappsmkdir newtypo3
and unpacking the source there.
After successfully unpacking the TYPO3 sources, use the TYPO3 installer just by
opening a browser and calling the URL http://127.0.0.1:9080/newtypo3/. If you do so,
TYPO3 will display the message to create the install file. You can do that just by
creating an empty file in the TYPO3 Webroot.
touch /opt/appserver/webapps/newtypo3/FIRST_INSTALL
To go ahead with the installation process you have to rectify the file permissions
in order for TYPO3 to create the necessary folders.
chmod -R 775 /opt/appserver/webapps/newtypo3/
After correcting the file permissions call the Installation Tool by using the URL
mentioned before and you will get the main installer. There might be some warnings
concerning the upload size and the php_max_execution time but there is no need to
fix that now. Move on with the installation process and type in the MySQL login
credentials. You can create a new database „typo3_newtest“ for example. After that
create a backend user and you are all set.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Additional Infos
To correct the issues occurred during the installation you just have to change your
PHP settings. If you are using the PHP-FPM delivered with appserver.io which is
configured by default you will find the php.ini in:
/opt/appserver/etc/
After changing the ini, you have to restart the PHP-FPM with the following
command:
sudo /opt/appserver/sbin/phpfpmctl restart
Installing with Virtual Host
As with any other Webserver using a vhost you first have to add the domain you
like to use in your hosts file.
sudo vi /etc/hosts
Add the following lines there:
127.0.0.1 typo3.local::1 typo3.localfe80::1%lo0 typo3.local
Afterwards you had to add the vhost to the webserver config of the appserver
which you also find in the appserver.xml. You will find two
<virtualHost name="typo3.local"> <params> <param name="admin" type="string"> [email protected] </param> <param name="documentRoot" type="string"> webapps/newtypo3 </param> </params> <rewrites> <rewrite condition="-d{OR}-f{OR}-l" target="" flag="L" /> <rewrite condition="index\.php" target="" flag="L" /> <rewrite condition="^(.+)\.(\d+)\.(php|js|css|png|jpg|gif|gzip)
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
$" target="$1.$3" flag="L" /> <rewrite condition="^/(typo3|t3lib|fileadmin|typo3conf|typo3temp|uploads|favicon\.ico)" target="" flag="L" /> <rewrite condition="^typo3$" target="typo3/index_re.php" flag="L" /> <rewrite condition=".*" target="index.php" flag="L" /> </rewrites></virtualHost>
After adding the Vhost restart the appserver and you should also be able to
request TYPO3 over the name based virtual host.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running Magento
appserver.io is a pretty cool and sophisticated infrastructure fully built upon the
PHP stack. This makes it truly easy to develop and extend the platform. appserver.io
comes with a built in webserver module that provides Fast-CGI support. Therefore it
is possible to run and install any PHP application. The following tutorial guides you
through the Magento installation process necessary to run on appserver.io.
Prerequisite: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of appserver.io
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
InstallationTo start, you have to download the latest Magento CE version from the Magento
website.
To install Magento, we have now two options. The easiest way is to install
Magento without creating a vhost. Therefore you just extract the Magento source
into the document root under /opt/appserver/webapps by opening a commandline
and type
$ cd /opt/appserver/webapps$ tar xvfz magento-community-1.9.1.0.tar.gz
This will create a folder magento and extracts the Magento source files to it.
Before you are able to step through the installation you MUST correct the rights of
the magento folder to ensure Magento is able to write the configuration files.
sudo chown -R _www:staff magentosudo chmod -R 775 magento
In addition, Magento requires an existing MySQL database and a user that has
access to the database. To create the database and the user, use the MySQL
command line utilities. To log in to the MySQL command line utilities, type
$ mysql -uroot -p
After successful login, create the database, the user and the password with
mysql> create database magento;mysql> grant all on magento.* to "magento"@"localhost" identified by "magento";mysql> flush privileges;
Optional you can use another database administration tool like phpMyAdmin to
create the database. Of course you can also install phpMyAdmin on appserver.io.
Now, as you are prepared to step through the Magento installer, start your
favorite browser and open http://127.0.0.1:9080/magento.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
The first step of the Magento installation wizard contains the OSL license and a
checkbox that allows to agree to the Magento Terms and Conditions. By activating
the checkbox, you agree to the Magento terms and conditions and are able to
proceed to step 2 by clicking on the button Continue.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
The first fieldset Database Connection requires the database configuration. As
you have created a database and the necessary user credentials before, you have to
enter these values here.
The second fieldset Web access options allows, beside the standard options, to
activate SSL to use secure URLs for the admin interface. As appserver.io generates
a default wildcard SSL certificate on startup, you can activate the Use Secure URLs
(SSL) checkbox.
After activation, another field and a checkbox will appear. As the default port for
SSL connections on appserver.io is, by default, NOT 443, you've to correct the
preset URL to https://127.0.0.1:9443/magento/. Then activate the checkbox Run
admin interface with SSL. All other options are good with their default values.
Generation of a self-signed SSL certificate can be tricky in some cases. appserver.io generates a self-signed SSL wildcard certificate during startup, without additional effort! You can find the generated certificate in the configuration directory under /opt/appserver/etc/appserver/server.pem. If you'll delete it, it'll be re-created with the next startup.
Proceed to step 3 by clicking on the button Continue.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
The final step of the installation wizard allows to create an admin account. This is
necessary to login to the the admin panel. Enter your personal data and the user
credentials here. The Encryption Key is optional, so you do not have to enter any
data here.
Finish the installation wizard by clicking on the button Continue.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Congratulations, you have successfully installed Magento on your local appserver.io infrastructure!
Securing your InstallationIn contrast to an installation on the Apache webserver, appserver.io actually can
not parse .htaccess files. So it is necessary to secure your installation manually by
adding the apropriate directives to the appserver.xml configuration file.
So, after the installation process, described above, the next step is to login to the
admin panel. To do this, open http://127.0.0.1:9080/magento/index.php/admin
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
and login with the user credentials that you created before. Delete the unread
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
messages and update the Indexers. There will be one message left below the top
navigation.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
This message is a result of a Magento internal security check that tries to open
the previously generated /opt/appserver/webapps/magento/app/etc/config.xml
by simulating a browser. Try it by yourself! Start your favorite browser and open
http://127.0.0.1:9080/magento/app/etc/config.xml. You should see a page
very similar to this
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
This means, depending on your appserver.io configuration, your Magento
configuration, including DB username and password, is visible to everyone that can
access your IP. To solve this is pretty simple!
Open /opt/appserver/etc/appserver/appserver.xml file with the editor of
your choice (you need admin access to edit this file).
First comment out the <access type="allow">...</access>, but explicitly allow
Magento index.php, media, skin and js by adding the following lines to the
<accesses> node.
<access type="allow"> <params> <param name="X_REQUEST_URI" type="string"> ^\/magento\/([^\/]+\/)?(media|skin|js|index\.php).* </param> </params></access>
Now the appserver.xml file should look like this
<appserver ... > <containers> <container name="combined-appserver"> <servers> ... <server name="http" ...> ... <accesses> <!-- per default deny everything --> <!-- access type="allow"> <params> <param name="X_REQUEST_URI" type="string">.*</param> </params> </access --> <access type="allow"> <params> <param name="X_REQUEST_URI" type="string"> ^\/magento\/([^\/]+\/)?(media|skin|js|index\.php).* </param> </params> </access>
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
</accesses> ... </server> <server name="https" ...> ... <accesses> <!-- per default deny everything --> <!-- access type="allow"> <params> <param name="X_REQUEST_URI" type="string">.*</param> </params> </access --> <access type="allow"> <params> <param name="X_REQUEST_URI" type="string"> ^\/magento\/([^\/]+\/)?(media|skin|js|index\.php).* </param> </params> </access> </accesses> ... </server> </servers> </container> </containers> </appserver>
Restart the application server and open the dashboard again. The security
warning should have been gone!
Adding RewritesAdding rewrite funtionality for your Magento installation is a very similar process
as to make it secure. Add the following lines to <server
name="http">...</server> and <server name="https">...</server> nodes.
<rewrites> <rewrite condition="-d{OR}-f{OR}-l" target="" flag="L" /> <rewrite condition="/magento/(.*)" target="index.php/$1" flag="L" /></rewrites>
Restart the application server and proceed to activate the Magento Rewrite
functionality in the admin panel.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Virtual Host ConfigurationTo use a virtual host to run Magento, follow the steps below. As with any other
webserver using a virtual host, first add the domain you like to use in your hosts file.
Assuming magento.dev is the domain where you want the local installation to be
available, you have to do the following steps. First, open the /etc/hosts (you need
admin access) with your favorite editor and add the following lines
::1 magento.dev127.0.0.1 magento.devfe80::1%lo0 magento.dev
and save the file.
Then add a virtual host node to the webserver configuration that you will find in
/opt/appserver/etc/appserver/conf.d/virtual-hosts.xml. Here is already an
example virtual host configuration available. Add the following configuration within
the <virtualHosts> node.
<virtualHost name="magento.dev"> <params> <param name="documentRoot" type="string">webapps/magento</param> </params> <rewrites> <rewrite condition="-d{OR}-f{OR}-l" target="" flag="L" /> <rewrite condition="(.*)" target="index.php/$1" flag="L" /> </rewrites> <accesses> <access type="allow"> <params> <param name="X_REQUEST_URI" type="string"> ^\/([^\/]+\/)?(media|skin|js|index\.php).* </param> </params> </access> </accesses></virtualHost>
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
After adding the virtual host restart the application server.
As Magento stores the base URL of the shop in the database, you MUST change
these URLs in the database. Again, login to the MySQL command line with
$ mysql -uroot -p
and execute the following SQL statements
UPDATE magento.core_config_data \ SET value = 'https://magento.dev:9443/' \ WHERE path = 'web/secure/base_url';
UPDATE magento.core_config_data \ SET value = 'http://magento.dev:9080/' \ WHERE path = 'web/unsecure/base_url';
Clear the Magento cache by executing
$ sudo rm -rf /opt/appserver/webapps/magento/var/cache/*
and you are all set. Start your favorite browser and open the URL
http://magento.dev:9080, voilá!
Rotating LogfilesRotating the Magento Logfiles can also be activated by adding the following lines
below the params node
<appserver ... > ... <scanners> <scanner name="logrotate-magento" type="AppserverIo\Appserver\Core\Scanner\LogrotateScanner"> <params> <param name="interval" type="integer">1</param> <param name="extensionsToWatch" type="string">log</param> <param name="maxFiles" type="integer">10</param> <param name="maxSize" type="integer">1048576</param> </params> <directories>
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
<directory>webapps/magento/var/log</directory> </directories> </scanner> </scanners> ...</appserver>
Keep in mind, that the directory webapps/magento/var/log has to be relative from the application servers base directory. You can also add multiple <directory> nodes pointing to directories containing files to be rotated.
After restarting the application server, your Magento log files will be rotated every
day, or if they reached 1 MB.
Executing Magento CRON JobsWhen you run Magento on a Debian Linux for example, you have to register the
cron.sh in your systems CRON table to be executed periodically. This is, for sure,
NO big deal, but it might come together with some handicaps like missing
permissions for example. If you run Magento inside appserver.io, life will be less
complicated, because you are able to execute the Magento CRON by a Stateless
session bean.
Creating a Stateless session bean is very simple, because this is a plain PHP
class with some annotations. Let us have a look at an example you can find in one of
our repositories.
<?php
/** * AppserverIo\Apps\Magento\Cron\SessionBeans\CronSessionBean * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * * PHP version 5 * * @author Tim Wagner <[email protected]> * @copyright 2015 TechDivision GmbH <[email protected]> * @license http://opensource.org/licenses/osl-3.0.php Open Software
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
License (OSL 3.0) * @link https://github.com/appserver-io-apps/magento-cron * @link http://www.appserver.io */
namespace AppserverIo\Apps\Magento\Cron\SessionBeans;
use AppserverIo\Psr\Application\ApplicationInterface;use AppserverIo\Psr\EnterpriseBeans\TimerInterface;use AppserverIo\Psr\EnterpriseBeans\TimedObjectInterface;
/** * A stateless session bean that invokes the magento CRON job. * * @author Tim Wagner <[email protected]> * @copyright 2015 TechDivision GmbH <[email protected]> * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * @link https://github.com/appserver-io-apps/magento-cron * @link http://www.appserver.io * * @Stateless */class CronSessionBean implements TimedObjectInterface{
/** * The application instance that provides the entity manager. * * @var \AppserverIo\Psr\Application\ApplicationInterface * @Resource(name="ApplicationInterface") */ protected $application;
/** * Example method that should be invoked after constructor. * * @return void * @PostConstruct */ public function initialize() { $this->getInitialContext()->getSystemLogger()->info( sprintf('%s has successfully been invoked by @PostConstruct annotation', __METHOD__) ); }
/** * The application instance providing the database connection. *
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
* @return \AppserverIo\Psr\Application\ApplicationInterface The application instance */ public function getApplication() { return $this->application; }
/** * Returns the initial context instance. * * @return \AppserverIo\Appserver\Application\Interfaces\ContextInterface The initial context instance */ public function getInitialContext() { return $this->getApplication()->getInitialContext(); }
/** * Invokes the Magento CRON implementation. * * @return void * @throws \Exception */ public function invoke() {
try {
// backup the old working directory $oldDir = getcwd();
// change current directory to the applications intallation directory chdir($this->getApplication()->getWebappPath());
// initialize Mage require_once $this->getApplication()->getWebappPath() . '/app/Mage.php';
// query whether Magento has been installed or not if (\Mage::isInstalled() === false) { throw new \Exception('Magento is not installed yet, please complete install wizard first.'); }
// configure Magento to run the CRON jobs \Mage::app('admin')->setUseSessionInUrl(false); \Mage::getConfig()->init()->loadEventObservers('crontab');
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
\Mage::app()->addEventArea('crontab');
// dispatch the events that executes the CRON jobs \Mage::dispatchEvent('always'); \Mage::dispatchEvent('default');
// restore the old working directory chdir($oldDir);
// log a mesage that Magento CRON has been invoked successfully $this->getInitialContext()->getSystemLogger()->debug( sprintf('%s has successfully been invoked at %s', __METHOD__, date('Y-m-d H:i:s')) );
} catch (Exception $e) { $this->getInitialContext()->getSystemLogger()->error($e->__toString()); } }
/** * Method invoked by the container upon timer schedule that will * invoke the Magento CRON handler. * * This method will be invoked every minute! * * @param TimerInterface $timer The timer instance * * @return void * @Schedule(dayOfMonth = EVERY, month = EVERY, year = EVERY, second = ZERO, minute = EVERY, hour = EVERY) */ public function invokedByTimer(TimerInterface $timer) {
// let the timer service invoke the CRON $this->invoke();
// log a message that the CRON has been invoked by the timer service $this->getInitialContext()->getSystemLogger()->debug( sprintf('%s has successfully been invoked by @Schedule annotation', __METHOD__) ); }
/** * Invoked by the container upon timer expiration. *
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
* @param \AppserverIo\Psr\EnterpriseBeans\TimerInterface $timer Timer whose expiration caused this notification * * @return void **/ public function timeout(TimerInterface $timer) { $this->getInitialContext()->getSystemLogger()->info( sprintf('%s has successfully been by interface', __METHOD__) ); }}
You have the choice. Either, save the PHP code from above into your Magento
application folder /opt/appserver/webapps/magento under META-
INF/classes/AppserverIo/Apps/Magento/Cron/SessionBeans/CronSessionBean.
php or read the installation instructions of the repository.
After restarting the application server, your Magento CRON jobs will be executed
every minute.
SummaryAfter finishing this tutorial, you have a completely optimized Magento installation
ready for production or your local development process.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running Wordpress
Appserver.io is a pretty cool and sophiscated infrastructure fully built upon the
PHP stack. This makes it truely easy to develop and extend the platform.
Appserver.io comes with an built in webserver module with PHP-FPM therefore it is
possible to install any PHP-App you like and run it on that platform. The following
guide shows you how easy it is to install appserver.io on a Mac and run Wordpress
on it.
Prerequirements: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of this tremendous platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation:You are now set to install and run your application on appserver.io. For that we
download the latest wordpress release from wordpress.org.
To go ahead and install wordpress we have now two options. The easiest way is to
install wordpress without creating a vhost. Therefore you just unpack the wordpress
source into your Webrootfolder which in case of the appserver is always the
webapps folder underneath /opt/appserver/webapps/. In that folder you will still find
the already installed example app and of course the welcome page. We are just
creating a folder with name „wordpress“ and unpacking the source there.
After successfully unpacking the wordpress sources you are able to use the
wordpress webinstaller just by opening a browser and calling the URL
http://127.0.0.1:9080/wordpress/. Before you step over the installation you should
correct the rights of the wordpress folder to ensure wordpress is able to write the
configuration.
chmod -R 775 /opt/appserver/webapps/wordpress/
Now you are free to step over the installation wizard and for that it is necessary to
create a database on your local running MySQL. To create a database you can use
the MySQL command line or just use another database administration tool like
phpMyAdmin. Of course you can also install phpMyAdmin on appserver.io. Just read
the appropriate tutorial.
To create the database by the command line just use the following line
mysql -uroot -p
Now you are on the MySQL command line and it is pretty easy to create an empty
database. Just use the following command.
CREATE DATABASE wordpress;
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Now you are ready to install wordpress. Just follow to steps on the install wizard.
If you want to use a virtual host to run wordpress simply follow the steps below.
As with any other Webserver using a vhost you first have to add the domain you'd
like to use in your hosts file.
sudo vi /etc/hosts
Add the following lines there:
127.0.0.1 wordpress.local::1 wordpress.localfe80::1%lo0 wordpress.local
Afterwards you have to add the vhost to the webserver config of the appserver
which you also find in /opt/appserver/etc/appserver/conf.d/virtual-
hosts.xml. There is already an example virtual host configuration available there.
Put the following configuration within the tag.
<virtualHost name="wordpress.local"> <params> <param name="admin" type="string">[email protected]</param> <param name="documentRoot" type="string">webapps/wordpress</param> </params></virtualHost>
After adding the Vhost you have to restart the appserver and you should start
with the installation like described at the beginning of this tutorial
sudo /opt/appserver/sbin/appserverctl restart
If you alread installed wordpress and now you want to use the configured
filename you just have to change the siteurl in the settings menu of wordpress.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running TYPO3 Neos
Appserver.io is a pretty cool and sophiscated infrastructure fully built upon the
PHP stack. This makes it truely easy to develop and extend the platform.
Appserver.io comes with an built in webserver module with PHP-FPM therefore it is
possible to install any PHP-App you like and run it on that platform. The following
guide shows you how easy it is to install appserver.io on a Mac and run TYPO3 Neos
on it.
Prerequirements: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of this amazingly platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation:Download the latest TYPO3 Neos Release from neos.typo3.org. To go ahead and
install TYPO3 Neos first you have to create a virtual host.
As with any other Webserver using a vhost you first have to add the domain you
like to use in your hosts file.
sudo vi /etc/hosts
Add the following lines there:
127.0.0.1 neos.local::1 neos.localfe80::1%lo0 neos.local
Afterwards you had to add the vhost to the webserver config of the appserver
which you also find in /opt/appserver/etc/appserver/conf.d/virtual-
hosts.xml. There is already an example virtual host configuration available there.
Put the following configuration within the tag.
<virtualHost name="neos.local"> <params> <param name="admin" type="string">[email protected]</param> <param name="documentRoot" type="string">webapps/neos/Web </param> </params> <rewrites> <rewrite condition="^/(_Resources/Packages/|robots\.txt|favicon\.ico){OR}-d{OR}-f{OR}-l" target="" flag="L" /> <rewrite condition="^/(_Resources/Persistent/[a-z0-9]+/(.+/)?[a-f0-9]{40})/.+(\..+)" target="$1$3" flag="L" /> <rewrite condition="^/(_Resources/Persistent/.{40})/.+(\..+)" target="$1$2" flag="L" /> <rewrite condition="^/_Resources/.*" target="" flag="L" /> <rewrite condition="(.*)" target="index.php" flag="L" /> </rewrites> <environmentVariables> <environmentVariable condition="" definition="FLOW_REWRITEURLS=1" />
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
<environmentVariable condition="" definition="FLOW_CONTEXT=Production" /> <environmentVariable condition="Basic ([a-zA-Z0-9\+/=]+)@$Authorization" definition="REMOTE_AUTHORIZATION=$1" /> </environmentVariables></virtualHost>
After adding the Vhost you have to restart the appserver and if everything was
correct you you can go ahead directly with the Neos installation itself.
sudo /opt/appserver/sbin/appserverctl restart
Therefore you just unpack the TYPO3 Neos source into your Webrootfolder which
in case of the appserver is always the webapps folder underneath
/opt/appserver/webapps/. In that folder you will still find the already installed
example app and of course the welcome page. We are just creating a folder with
name „neos“ and unpacking the source there. Now you have to change the rights so
Neos is able to create folders and files below.
chmod -R 775 /opt/appserver/webapps/neos/
After that you are able to use the TYPO3 Neos installer just by opening a browser
and calling the URL http://neos.local:9080/setup. If you do so TYPO3 Neos let you go
thorugh the installation easily. At the first page Neos is asking for the initial
installation password which you can find in
/opt/appserver/webapps/neos/Data/SetupPassword.txt
Now you just have to type in your database credentials and select if you want to
use an existing database or want to create a new one. The second last step is
creating an user account. Finally you are able to import the Demo site package or if
you already have developed your own site packege you can import that as well.
Now you are all set and can enjoy the power TYPO3 Neos.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running Drupal
Appserver.io is a cool and sophiscated infrastructure fully built upon the PHP
stack. This makes it truely easy to develop and extend the platform. Appserver.io
comes with an built in webserver module with PHP-FPM therefore it is possible to
install any PHP-App and run it on that platform. The following guide shows how easy
it is to install appserver.io on a Mac and run Wordpress.
Prerequisite: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of this amazing platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation:In order to run the application on appserver.io, download the latest drupal release
from drupal.org.
To install drupal there are now two options. The easiest way is to install drupal
without creating a vhost. Therefore just unpack the drupal source into your
Webrootfolder which in case of the appserver is always the webapps folder
underneath /opt/appserver/webapps/. In that folder you will still find the already
installed example app and of course the welcome page. Just create a folder named
„drupal“ and unpack the source there.
After successfully unpacking the drupal sources you are able to use the drupal
webinstaller just by open a browser and calling the URL
http://127.0.0.1:9080/drupal/. Before you you start the installation it is necessary to
create a settings.php file. Copy the default settings
cp /opt/appserver/webapps/drupal/sites/default/default.settings.php /opt/appserver/webapps/drupal/sites/default/settings.php
In addition make sure to correct the rights of the drupal folder to ensure drupal is
able to write the configuration.
chmod -R 775 /opt/appserver/webapps/drupal/
Now you are free to step through the installation wizard and therefore it is
necessary to create a MySQL database. To create a database you can use the MySQL
command line or just use another database administration tool like phpMyAdmin. Of
course you can also install phpMyAdmin on appserver.io. Just read the tutorial.
To create the database by the command line just use the following line
mysql -uroot -p
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
On the MySQL command line it is easy to create an empty database. Just use the
following command.
CREATE DATABASE drupal;
Now you are ready to install drupal. Just follow the install wizard.
Installing with Virtual Host
To run a virtual host simply follow the steps below. As with any other Webserver
using a vhost you have to add the domain you like to use in your hosts file first.
sudo vi /etc/hosts
Add the following lines:
127.0.0.1 drupal.local::1 drupal.localfe80::1%lo0 drupal.local
Afterwards add the vhost to the webserver config of the appserver which you also
find in /opt/appserver/etc/appserver/conf.d/virtual-hosts.xml. There is
already an example virtual host configuration available. Add the following
configuration within the tag.
<virtualHost name="drupal.local"> <params> <param name="admin" type="string">[email protected]</param> <param name="documentRoot" type="string">webapps/drupal</param> </params></virtualHost>
After adding the Vhost, restart the appserver and start with the Installation as
described at the beginning of this tutorial
sudo /opt/appserver/sbin/appserverctl restart
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running phpMyAdmin
Appserver.io is a pretty cool and sophiscated infrastructure fully built upon the
PHP stack. This makes it truely easy to develop and extend the platform.
Appserver.io comes with an built in webserver module with PHP-FPM therefore it is
possible to install any PHP-App you like and run it on that platform. The following
guide shows you how easy it is to install appserver.io on a Mac and run Wordpress
on it.
Prerequisite: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0-rc3). If you
are new to this project you can easily download and follow the installation guide for
your specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want ot check out the
capabilities of this incredible platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation:Download the latest phpMyAdmin release from http://phpmyadmin.net.
After successfully unpacking the phpmyadmin sources into the webapps folder
within the your appserver installation you should correct the rights of the
phpmyadmin folder to ensure phpmyadmin is able to write to the configuration.
chmod -R 775 /opt/appserver/webapps/phpmyadmin/
Please note that we renamed the folder to lower case just for a more convenient handling.
Now you are able to login into your phpMyAdmin installation just by opening the
following URL in your favourite browser.
http://localhost:9080/phpmyadmin
Just log in with your MySQL credentials and you are able to administer your
database.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Running Joomla
Appserver.io is a cool and sophiscated infrastructure fully built upon the PHP
stack. This makes it truely easy to develop and extend the platform. Appserver.io
comes with an built in webserver module with PHP-FPM therefore it is possible to
install any PHP-App and run it on that platform. The following guide shows how easy
it is to install appserver.io on a Mac and run Wordpress.
Prerequisite: Up and running installation of MySQL
You will need a running installation of appserver.io (>= Version 1.0.0). If you are
new to this project you can easily download and follow the installation guide for your
specific OS.
After the setup has finished the appserver.io is up and running and you can call
the welcome page with
http://localhost:9080/
By default, appserver.io is configured to run on port 9080 in order to not to affect
any existing webserver installations. You can easily change that in the
/opt/appserver/etc/appserver.xml just by going to section
<server name="http" ...
and change the port within that section for example to 80. After that restart the
appserver.io which can be done with the following command.
sudo /opt/appserver/sbin/appserverctl restart
Of course there is no need to change the port if you only want to check out the
capabilities of this amazing platform.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installation:In order to run the application on appserver.io, download the latest joomla release
from joomla.org.
To install joomla there are now two options. The easiest way is to install joomla
without creating a vhost. Therefore just unpack the joomla source into your
Webrootfolder which in case of the appserver is always the webapps folder
underneath /opt/appserver/webapps/. In that folder you will still find the already
installed example app and of course the welcome page. Just create a folder named
„joomla“ and unpack the source there.
After successfully unpacking the joomla sources you are able to use the joomla
webinstaller just by open a browser and calling the URL
http://127.0.0.1:9080/joomla/. Before you you start the installation it is necessary to
correct the rights of the joomla folder to ensure joomla is able to write the
configuration.
chmod -R 775 /opt/appserver/webapps/joomla/
Now you are free to step through the installation wizard and therefore it is
necessary to create a MySQL database. To create a database you can use the MySQL
command line or just use another database administration tool like phpMyAdmin. Of
course you can also install phpMyAdmin on appserver.io. Just read the tutorial.
To create the database by the command line just use the following line
mysql -uroot -p
On the MySQL command line it is easy to create an empty database. Just use the
following command.
CREATE DATABASE joomla;
Now you are ready to install joomla. Just follow the install wizard.
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH
Installing with Virtual Host
To run a virtual host simply follow the steps below. As with any other Webserver
using a vhost you have to add the domain you like to use in your hosts file first.
sudo vi /etc/hosts
Add the following lines:
127.0.0.1 joomla.local::1 joomla.localfe80::1%lo0 jomla.local
Afterwards add the vhost to the webserver config of the appserver which you also
find in /opt/appserver/etc/appserver/conf.d/virtual-hosts.xml. There is
already an example virtual host configuration available. Add the following
configuration within the tag.
<virtualHost name="joomla.local"> <params> <param name="admin" type="string">[email protected]</param> <param name="documentRoot" type="string">webapps/joomla</param> </params></virtualHost>
After adding the Vhost, restart the appserver and start with the Installation as
described at the beginning of this tutorial
sudo /opt/appserver/sbin/appserverctl restart
© appserver.io 2015 – Eine eingetragene Marke und Produkt der TechDivision GmbH