by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

foreword

Install Laravel 5.4 on Zhibang's Linux 7.0 platform, and successfully execute the case sharing,
Because it was originally an old version of the PHP execution environment, it can be transferred to the new version for free for the first time.
Therefore, a test php 7.0 environment was opened for us to test. After minor adjustments,
The environment of Laravel can indeed be executed on the managed php 7.0.x host of Zhibang,
This article introduces how I successfully implemented Laravel's website process in Zhibang.

The following content is for reference only

Be sure to ask for a trial, I can't guarantee that it will work in your environment.
 

upload

1. Upload the entire Laravel project to the hosting provider through FTP . The www on the original Zhibang is renamed to www_old. After the upload is complete, the Laravel public folder is renamed to www.


Settings and Adjustments

2. Zhibang uses the Apache server, and the default .htaccess file cannot be used.
Using the simple version provided by the official website, make sure your public/.htaccess file looks like this:
Options +FollowSymLinks
Rewrite Engine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} ! -f
RewriteRule ^ index.php [L]

3. Mandatory conversion to SSL (not necessary), if your website uses HTTPS.
Options +FollowSymLinks
Rewrite Engine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} ! -f
RewriteRule ^ index.php [L]


Fourth, here we need to correct public_path(); let him print the correct path,

Example: The root directory of Vhost's website is /raid/vhost/example.com.tw/www ( when displayed with echo __DIR__; ),
But Laravel's public_path(); will become.../raid/vhost/example.com.tw/ public , incorrect,
Therefore, through the following settings, the public_path() can be displayed as /raid/vhost/example.com.tw/www,
The root directory of the website set by Accton Apache host.

We can fix the above problem by adjusting the content of public/index.php.
$app = require_once __DIR__.'/../bootstrap/app.php';
// Set the public folder to return to the current directory (that is, www)
$app->bind('path. public', function() {
return __DIR__;
});

Other things to pay attention to may be that the directory of the filessystem needs to be adjusted.
.env database connection and other related adjustments.

 

Tags: web-hosting laravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


dlaravel

D-Laravel v1.5.0 is a new version.

1. Change the image generation method of fpm, optimize dockerfiles/fpm/php7.x/Dockerfiles, and make it easier to set and adjust extension packages. 2. Adjust docker-compose-build.yml, and in the Project directory of D-Laravel, You can quickly build your own image through ./console build. And many more changes....

laravel

How to use Laravel's Validator to customize error messages

When we usually develop Laravel, sometimes field validation is performed, but the default message using Validator is in English. But of course I want to have a more accurate display of Chinese message display, This article describes how I use Laravel's Validator to customize Chinese messages.

laravel

Laravel 5.6 has those new changes

Laravel 5.6 is scheduled to be released in February 2018, what changes? Let's see. (Argon2i Password Hashing Algorithm) ​​​​​​​​Argon2 provides the following three versions: 1. In Laravel 5.6, Argon2i password hashing algorithm will be supported. (Argon2i Password Hashing Algorithm) 2. Argon2d resists GPU cracking attacks to the greatest extent. 3. Argon2i is optimized to resist side-channel attacks. Third, Argon2id is a hybrid version. It follows the Argon2i method for the first pass, and then uses the Argon2d method for subsequent passes. It doesn't matter if you don't understand it, I don't understand it anyway, the point is, it's safe to be sure anyway.This is the Open Cryptography Contest (PHC) on July 20, 2015