Chapter: Configuring a production server
^ Deploying a Jelix application | Installing an application » |
− Table of content
We call production server, the server on which you will install your finished application, therefore accessible to the end-users. By opposition, the server on which you develop your application is called the development server.
There are certain different things to take in account for a production server, in order to optimize the execution of your application based on Jelix, and to protect your server.
Choosing the good edition of Jelix ¶
To develop, you use of course the "developer" edition of Jelix. This edition includes some additionals instructions for logger, to help debugging etc.
However, for the installation on a production server, it is preferable to install the "optimized" edition of Jelix. As its name indicates it, it is optimized, and the useless things in production are removed. Note however that your application will function exactly the same way as with one of the other editions of Jelix, except for one detail: there will be some light performance improvements with the "Optimized" edition!
If you choose to remain with the "developer" edition on your production server, there is no problem with that.
A "Gold" edition is also available, it is intended for the developers who can modify the php configuration, and especially install PHP extensions. Indeed, this edition uses some PHP extensions which are not available among all hosts, and this edition uses also a PHP extension especially dedicated to Jelix, which deals with certain processes of the framework. The use of "gold" edition thus significantly improves the performances of your application. You have to compile the jelix extension yourself. Therefore, the source code of this extension is provided in the package of the Gold edition.
Configuration ¶
About the server configuration ¶
- All directories, except the
www
directory of your app, should be outside the document root of the web site. So you should set the root of your web site on thiswww
directory. See the chapter about the server configuration for examples of such configuration. - To specify the rights well on the
temp/your_app/
directory. For example, the user which runs Apache should have write rights an this directory. It is not recommended on linux, to chmod 0777 on the temp directory ;-)
About the application ¶
Here some advices for the configuration of the application, in the var/config/defaultconfig.ini.php
file.
section jResponseHtml ¶
Déactivate the debugbar plugin.
configuration du logger ¶
If you still use the "dev" edition of jelix on your production server, remove the line sql=...
, soap=...
and other type of log that you think it isn't relevant. And remove the logger "memory" in each type of log. It will save some memory (the "memory" logger is only useful for the debugbar)
Compilation section ¶
In the section [compilation], you can deactivate the option checkCacheFiletime, and even more recommended, the option forces, if you activated it for the development.
[compilation]
checkCacheFiletime = off
force = off
The option checkCacheFiletime prevents Jelix from checking all the time that the cache (files generated by Jelix for the files of configurations, the DAO, templates, etc.) is up to date compared to the files in the application directory. This checking is generally useless in production, since the application is rarely modified, and each modification is usually meant to be activated as fast as possible. Of course, if you deactivate it, you should imperatively empty the directory of cache (temp/myapp/
) at each update of your application, so that your modifications are well taken into account.
Mailer section ¶
Do not forget to update the parameters of the [mailer] section. Usually, the mailer parameters are different between your development server and your production server unless you use third party solutions.
If your server is behind a proxy ¶
if you server is not listen on standard port, you should indicate to jelix that it should generate urls with standard port (for the proxy). In the general section:
forceHTTPPort = true
forceHTTPSPort = true
And you should probably indicate the real domain name of the site (else Jelix use the server name)
domainName = www.example.com
If the "basePath" value of the server does not correspond to the "public" basePath, (ex: the proxy redirect urls like http:example.com/index.php to your backend server http:backend.example.com/foo/bar/index.php), You have to indicate the "public" basePath and the backend base Path:
[urlengine]
basePath= /
backendBasePath = /foo/bar
And if the proxy redirect HTTPS request to HTTP, you must deactivate the HTTPS check
[urlengine]
checkHttpsOnParsing = off