简体   繁体   中英

How can I deploy a Laravel 4 application for production?

When we are developping a Laravel app, we can use

php artisan serve

to serve Laravel. However, I saw in other StackOverflow posts that we should NEVER use this command for production

So, how can we serve Laravel? Is there a command for it? I couldn't find a straightforward tutorial that teaches how to deploy Laravel for production.

You can point the server on the config file to the public folder for example in apache:

Change DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/laravel/appname/public/"

On the production Server

php artisan serve uses PHP's build in web server which is designed purely for development purposes. In order for this to work for everyone else, you're going to need a more powerful server.

You're main two options will be Apache and Nginx . I don't want to recommend any guides because I haven't read any (I learned on the job so I might be doing things wrong myself). However, the internet is full of guides, and articles describing the differences between the two.

Unfortunately, edits to Filipe Ferreira's answer have been rejected. Here is some important information on how to deploy Laravel4 to apache

You can point the server on the config file to the public folder for example in apache:

Change DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/laravel/appname/public/"

On the production Server

Or, in Linux, you can follow the steps described HERE

Also, when deploying, DO remember to have mod_rewrite enabled

sudo a2enmod rewrite

And to configure your .htaccess file, as shows HERE

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM