Quick links: Content - sections - sub sections
EN

Trace: production-serveur

Si chiama server di produzione il sistema dove viene installata l'applicazione sviluppata, utilizzabile dagli utenti finali. Al contrario, il sistema dove l'applicazione viene sviluppata è chiamato server di sviluppo.

Ci sono alcune differenze da tenere in considerazione per un server di produzione, allo scopo di ottimizzare l'esecuzione della vostra applicazione basata su Jelix, e per consentire una adeguata protezione del server stesso.

Scegliere l'edizione corretta di Jelix

Per sviluppare, scegliete l'edizione “developer”; questa versione include strumenti e script a linea di comando ed altre utilità per lo sviluppo.

Per l'installazione su un server di produzione è preferibile installare l'edizione “optimized”. Come indica il nome, è stata ripulita di quanto non essenziale in fase di produzione, ma le vostre applicazioni funzioneranno esattamente come nelle altre edizioni di Jelix. Le prestazioni saranno invece leggermente migliorate.

Anche se sceglierete di produrre con la versione “developer” non ci sono problemi dinota. Tuttavia è preferibile rimuovere tutti gli script a linea di comando contenuti nella cartella lib/jelix-scripts.

Anche una versione “gold” è disponibile; è pensata per gli sviluppatori che vogliano modificare le configurazioni e, specialmente installare estensioni PHP. Inoltre questa edizione usa alcune estensioni PHP che non sono diffuse in tutti i sistemi, ma che sono legate in modo particolare al modo in cui Jelix opera internamente. La versione “gold” migliora sensibilmente le prestazioni delle vostre applicazioni. Tuttavia dovrete compilare da soli tali estensioni; i sorgenti sono inclusi nel pacchetto dell'edizione stessa.

Configurazione

Il processo di installazione è identico all'ambiente di sviluppo, incluso quanto riguarda l'applicazione stessa.

Allo scopo di ottenere le migliori prestazioni e garantire una maggiore sicurezza, di seguito sono riportati alcuni consigli aggiuntivi.

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 this www directory or move the content of www to the root of your web site. See the chapter on the application 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.

error_handling section

In the section error_handling, the following configuration is highly advised:

[error_handling]
messageLogFormat = "%date%\t[%code%]\t%msg%\t%file%\t%line%\n"
logFile = error.log
email = root@localhost
emailHeaders = "From: webmaster@yoursite.com\nX-Mailer: Jelix\nX-Priority: 1 (Highest)\n"
quietMessage="A technical error has occured. Sorry for this trouble."
 
showInFirebug = off

; keywords you can use : ECHO, ECHOQUIET, EXIT, LOGFILE, SYSLOG, MAIL, TRACE
default      = ECHOQUIET EXIT LOGFILE
error        = ECHOQUIET EXIT LOGFILE
warning      = ECHOQUIET LOGFILE
notice       =  
strict       = 
; for the exceptions, there is implicitly EXIT
exception    = ECHOQUIET LOGFILE

It is not advised to use the keyword ECHO, which posts all the details of the errors on the website (information which could be useful for pirates), but rather ECHOQUIET, which posts simply the message indicated in the parameter quietMessage.

However, it is useful to be informed of the errors and their details. Also, parallel to ECHOQUIET, it is recommended to add one of these key words

  • LOGFILE: the errors are inserted in the file indicated in logFile.
  • SYSLOG: the errors are recorded on the level of the system.
  • EMAIL: the errors are sent by email to email.

Be careful with the use of EMAIL: use it only once you know that your application functions well on the production server. Else you may be flooded with emails (and your hosting provider may not be very happy with that, and could think you're a spammer).

Be careful also with the use of SYSLOG: put this option only if it is your own server (i.e. you are an administrator of the machine). Else the owner of the machine is likely not to appreciate.

In conclusion: LOGFILE is recommended instead of EMAIL or SYSLOG.

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.

it/manuale-1.1/installation/production-serveur.txt · Last modified: 2010/03/17 17:58 by aiacoponi

Recent changes RSS feed Creative Commons License