Deployment Optimizations
openClinic is based on Laravel thus a few of Laravel methods on deployment are applicable in this application. In this guide, we'll be looking on a few optimization methods for deployment.
Nginx Server Configuration
If you are deploying your application to a server that is running Nginx, you may use the following configuration file as a starting point for configuring your web server. Most likely, this file will need to be customized depending on your server's configuration.
server {
listen 80;
server_name example.com;
root /example.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Optimizing Configuration Loading
When deploying your application to production, you should make sure that you run the config:cache
Artisan command during your deployment process:
php artisan config:cache
This command will combine all of Laravel's & openClinic's configuration files into a single, cached file, which greatly reduces the number of trips the system must make to the filesystem when loading your configuration values.
Updated almost 6 years ago