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.
About the server configuration ¶
- All directories, except the
wwwdirectory of your app, should be outside the document root of the web site. So you should set the root of your web site on this
wwwdirectory. 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
section jResponseHtml ¶
Deactivate the debugbar plugin.
configuration du logger ¶
If you still use the "dev" edition of jelix on your production server, remove the line
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 reverse proxy ¶
In some networks, the web server that run Jelix is behind a reverse-proxy (a load balancer, HaProxy or an other web server configured as a reverse-proxy like Nginx). So the web server is not configured as a frontal web server: it has not the domain name of the web site, it may not listen on standard port or the reverse proxy communicate HTTPS request as HTTP request to the web server, etc.
If your server is not listening on a 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 (so the domain name of the reverse-proxy), else Jelix uses the web server name.
domainName = www.example.com
If the "basePath" value of the web server does not correspond to the "public" basePath as requested to the reverse proxy, (ex: the proxy redirects urls like http://example.com/index.php to your web 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
If the reverse proxy redirect HTTPS request to HTTP, you must deactivate the HTTPS check for URL engines:
[urlengine] checkHttpsOnParsing = off
And since Jelix 1.6.16, you can indicate to force all generated URL with the HTTPS protocol, because it doesn't know what it the protocol used by requests on the reverse proxy:
[urlengine] forceProxyProtocol = https