Laravel deployment... there is a standard way?

Asked
Active3 hr before
Viewed126 times

6 Answers

standardlaraveldeployment
90%

This is not really a Laravel problem/question, you have to ask on a dev-ops forum what they would do to deploy a PHP application like yours.,Don't forget that Laravel itself has it's own SSH Remote component (I used it on Deeployer and Rocketeer uses it too), that might help you do whatever you need to deploy your app.,Here is a way to deploy Laravel using Rocketeer and Git. It is very easy to setup and allows you to use multiple servers (think staging, production, etc.),I have read something interesting from Anahkiasen/rocketeer and Christopher Pitt, both great sources but there is a consensus or standard way to publish applications using laravel?

Here is an example of simple task:

task('my_task', function() {
   // Your tasks code...
});
88%

When deploying to production, make sure that you are optimizing Composer's class autoloader map so Composer can quickly find the proper file to load for a given class:,When deploying your application to production, you should make sure that you run the view:cache Artisan command during your deployment process:,When deploying your application to production, you should make sure that you run the config:cache Artisan command during your deployment process:,When you're ready to deploy your Laravel application to production, there are some important things you can do to make sure your application is running as efficiently as possible. In this document, we'll cover some great starting points for making sure your Laravel application is deployed properly.

Please ensure, like the configuration below, your web server directs all requests to your application's public/index.php file. You should never attempt to move the index.php file to your project's root, as serving the application from the project root will expose many sensitive configuration files to the public Internet:

server {
   listen 80;
   server_name example.com;
   root / srv / example.com / public;

   add_header X - Frame - Options "SAMEORIGIN";
   add_header X - Content - Type - Options "nosniff";

   index 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 .4 - fpm.sock;
      fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
      include fastcgi_params;
   }

   location~/\.(?!well-known).* {
   deny all;
}
}
load more v
72%

Notice 1: please take this article as personal advice but not 100% accurate process. Every team have their own way to deploy projects, so you may read different advice elsewhere.,Enough formalities, let’s dive in. In this article, we will cover these steps:, Or you can set up the access following these instructions.,Congratulations, if you’ve reached this far, you have deployed Laravel project to your server!

Part 8. Configure Web-server. Prepare a specific folder for your website. Here’s an example Nginx config provided in official Laravel documentation.

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_split_path_info ^ (. + \.php)(/.+)$;
         fastcgi_pass unix: /var/run / php / php7 .1 - fpm.sock; fastcgi_index index.php; include fastcgi_params;
      }

      location~/\.(?!well-known).* {
      deny all;
   }
}
load more v
65%

When it comes to updating a live application, there are two fundamentally different ways of going about this.,Looking at two different releases, this added information could help us easily understand the nature of changes introduced between them.,The reason I fell in love with Laravel at first sight was how its author paid close attention to details, thought about the convenience of developers, and also incorporated a lot of best practices into the framework, like database migrations.,Eloquent ORM, fluent query builder, great documentation, and always up-to-date Laracasts are definitely making the framework stand out. Laravel embraces automation and rapid development with providing tools like Artisan.

Our structure can be something like this:

/opt/demo / release / v0 .1 .0 /
   opt / demo / release / v0 .1 .1 /
   opt / demo / release / v0 .1 .2
load more v
75%

You’ve been developing your new Laravel project locally for some time, you’ve hit your feature milestones and the app has passed testing. Everything is checked in to your git master branch, so now it’s time to deploy it to a live server and let your end customers access it.,Finally, we’ll assume you’ve checked your code into your git repository and you have all the necessary credentials to access it from your server.,You’ll also need SSH access to run terminal commands as part of the deployment process. ,If your app requires a database make sure you have a suitable database set up and have the credentials to hand.

So from inside the /example.com/ directory, run 

git clone http: //[GIT_SERVER]/your-app.git
load more v
40%

And, finally, deploy the application:,The releases directory contains deploy releases of the Laravel application.,On your local machine change the working directory to your application’s folder:, Step 6 — Deploying the Application

On your local machine, open the terminal and download the Deployer installer using curl:

curl - LO https: //deployer.org/deployer.phar
load more v

Other "standard-laravel" queries related to "Laravel deployment... there is a standard way?"