Laravel is an open-source PHP framework that provides a set of tools and resources to build modern PHP applications. With a complete ecosystem leveraging its built-in features, Laravel’s popularity has grown rapidly in the past few years, with many developers adopting it as their framework of choice for a streamlined development process.
Laravel是一个开放源代码PHP框架,提供了用于构建现代PHP应用程序的一组工具和资源。 凭借其内置功能的完整生态系统 ,Laravel的受欢迎程度在过去几年中Swift增长,许多开发人员将其用作简化开发过程的首选框架。
In this guide, you’ll install and configure a new Laravel application on an Ubuntu 20.04 server, using Composer to download and manage the framework dependencies and Nginx to serve the application. When you’re finished, you’ll have a functional Laravel demo application pulling content from a MySQL 8 database.
在本指南中,您将在Ubuntu 20.04服务器上安装和配置新的Laravel应用程序,使用Composer下载和管理框架依赖关系,并使用Nginx为该应用程序提供服务。 完成后,您将拥有一个功能正常的Laravel演示应用程序,可从MySQL 8数据库中提取内容。
In order to complete this guide, you will first need to perform the following tasks on your Ubuntu 20.04 server:
为了完成本指南,您首先需要在Ubuntu 20.04服务器上执行以下任务:
Create a sudo
user and enable ufw
. To set this up, you can follow our Initial Server Setup with Ubuntu 20.04 guide.
创建一个sudo
用户并启用ufw
。 要进行设置,可以遵循我们的《 Ubuntu 20.04初始服务器设置》指南。
Install a LEMP stack with MySQL 8. If you haven’t set this up yet, you can follow steps 1 to 3 of our guide on How to Install Nginx, MySQL and PHP on Ubuntu 20.04.
使用MySQL 8安装LEMP堆栈 。 如果尚未进行设置,则可以按照我们的指南的步骤1至3进行操作,该指南如何在Ubuntu 20.04上安装Nginx,MySQL和PHP 。
Install Composer. We’ll use Composer to install Laravel and its dependencies. You can install Composer by following our guide on How to Install Composer on Ubuntu 20.04.
安装Composer 。 我们将使用Composer安装Laravel及其依赖项。 您可以按照关于如何在Ubuntu 20.04上安装Composer的指南进行安装 。
Before you can install Laravel, you need to install a few PHP modules that are required by the framework. We’ll use apt
to install the php-mbstring
, php-xml
and php-bcmath
PHP modules. These PHP extensions provide extra support for dealing with character encoding, XML and precision mathematics.
在安装Laravel之前,您需要安装框架所需的一些PHP模块。 我们将使用apt
安装php-mbstring
, php-xml
和php-bcmath
PHP模块。 这些PHP扩展为处理字符编码,XML和精确数学提供了额外的支持。
If this is the first time using apt
in this session, you should first run the update
command to update the package manager cache:
如果这是此会话中第一次使用apt
,则应首先运行update
命令来更新程序包管理器缓存:
Now you can install the required packages with:
现在,您可以通过以下方式安装所需的软件包:
Your system is now ready to execute Laravel’s installation via Composer, but before doing so, you’ll need a database for your application.
您的系统现在可以通过Composer执行Laravel的安装了,但是在这样做之前,您需要为应用程序提供数据库。
To demonstrate Laravel’s basic installation and usage, we’ll create a travel list application to show a list of places a user would like to travel to, and a list of places that they already visited. This can be stored in a places table with a field for locations that we’ll call name and another field to mark them as visited or not visited, which we’ll call visited. Additionally, we’ll include an id field to uniquely identify each entry.
为了演示Laravel的基本安装和用法,我们将创建一个旅行列表应用程序,以显示用户想要旅行的地方列表以及他们已经访问过的地方列表。 这可以存储在一个places表中,其中有一个我们称之为名称的位置的字段和一个将它们标记为已访问或未访问的字段,我们称其为Visited 。 此外,我们将包含一个ID字段,以唯一标识每个条目。
To connect to the database from the Laravel application, we’ll create a dedicated MySQL user, and grant this user full privileges over the travellist
database.
要从Laravel应用程序连接到数据库,我们将创建一个专用MySQL用户,并向该用户授予对travellist
数据库的完全特权。
At the time of this writing, the native MySQL PHP library mysqlnd
doesn’t support caching_sha2_authentication
, the default authentication method for MySQL 8. We’ll need to set up our database user with the mysql_native_password
authentication method in order to be able to connect to the MySQL database from PHP.
在撰写本文时,本机MySQL PHP库mysqlnd
不支持 caching_sha2_authentication
,这是MySQL 8的默认身份验证方法。我们需要使用mysql_native_password
身份验证方法来设置数据库用户,以便能够连接到PHPMySQL数据库。
To get started, log in to the MySQL console as the root database user with:
首先,以root数据库用户身份登录MySQL控制台:
To create a new database, run the following command from your MySQL console:
要创建新数据库,请从MySQL控制台运行以下命令:
CREATE DATABASE travellist;
创建数据库旅行清单 ;
Now you can create a new user and grant them full privileges on the custom database you’ve just created. In this example, we’re creating a user named travellist_user with the password password
, though you should change this to a secure password of your choosing:
现在,您可以创建一个新用户,并向他们授予您刚创建的自定义数据库的全部特权。 在此示例中,我们将使用密码password
创建一个名为travellist_user的password
,尽管您应将其更改为您选择的安全密码:
CREATE USER 'travellist_user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
创建用户' travellist_user '@'%'用mysql_native_password标识' 密码 ';
Now we need to give this user permission over the travellist
database:
现在,我们需要授予该用户对travellist
数据库的权限:
GRANT ALL ON travellist.* TO 'travellist_user'@'%';
将所有内容授予旅行清单 。* TO'travellist_user '@'%';
This will give the travellist_user user full privileges over the travellist
database, while preventing this user from creating or modifying other databases on your server.
这将赋予travellist_user用户对travellist
数据库的完全特权,同时阻止该用户在服务器上创建或修改其他数据库。
Following this, exit the MySQL shell:
接下来,退出MySQL shell:
You can now test if the new user has the proper permissions by logging in to the MySQL console again, this time using the custom user credentials:
现在,您可以使用自定义用户凭据再次登录到MySQL控制台,以测试新用户是否具有适当的权限:
mysql -u travellist_user -p
mysql -u travellist_user -p
Note the -p
flag in this command, which will prompt you for the password used when creating the travellist_user user. After logging in to the MySQL console, confirm that you have access to the travellist
database:
请注意此命令中的-p
标志,它将提示您输入创建travellist_user用户时使用的密码。 登录到MySQL控制台后,确认您有权访问travellist
数据库:
This will give you the following output:
这将为您提供以下输出:
Output
+--------------------+
| Database |
+--------------------+
| information_schema |
| travellist |
+--------------------+
2 rows in set (0.01 sec)
Next, create a table named places
in the travellist
database. From the MySQL console, run the following statement:
接下来,在travellist
数据库中创建一个名为places
的表。 在MySQL控制台中,运行以下语句:
CREATE TABLE travellist.places (
创建表旅行清单 。 地方 (
Now, populate the places
table with some sample data:
现在,用一些示例数据填充places
表:
INSERT INTO travellist.places (name, visited)
插入旅行清单 。 地点 (名称,访问过的地点)
VALUES ("Tokyo", false),
值(“ Tokyo ”, false ),
("Budapest", true),
(“ 布达佩斯 ”, 是的 ),
("Nairobi", false),
(“ 内罗毕 ”, 假 ),
("Berlin", true),
(“ 柏林 ”, 是 ),
("Lisbon", true),
(“ 里斯本 ”, 是 ),
("Denver", false),
(“ 丹佛 ”, false ),
("Moscow", false),
(“ 莫斯科 ”, 假 ),
("Olso", false),
(“ Olso ”, false ),
("Rio", true),
(“ Rio ”, 是 ),
("Cincinnati", false),
(“ 辛辛那提 ”, 假 ),
("Helsinki", false);
(“ 赫尔辛基 ”, 假 );
To confirm that the data was successfully saved to your table, run:
要确认数据已成功保存到表中,请运行:
SELECT * FROM travellist.places;
选择*从旅行清单 。 地方 ;
You will see output similar to this:
您将看到类似于以下的输出:
Output
+----+-----------+---------+
| id | name | visited |
+----+-----------+---------+
| 1 | Tokyo | 0 |
| 2 | Budapest | 1 |
| 3 | Nairobi | 0 |
| 4 | Berlin | 1 |
| 5 | Lisbon | 1 |
| 6 | Denver | 0 |
| 7 | Moscow | 0 |
| 8 | Oslo | 0 |
| 9 | Rio | 1 |
| 10 | Cincinnati| 0 |
| 11 | Helsinki | 0 |
+----+-----------+---------+
11 rows in set (0.00 sec)
After confirming that you have valid data in your test table, you can exit the MySQL console:
确认测试表中有有效数据后,可以退出MySQL控制台:
You’re now ready to create the application and configure it to connect to the new database.
现在,您可以创建应用程序并将其配置为连接到新数据库了。
You will now create a new Laravel application using the composer create-project
command. This Composer command is typically used to bootstrap new applications based on existing frameworks and content management systems.
现在,您将使用composer create-project
命令创建一个新的Laravel应用程序。 该Composer命令通常用于基于现有框架和内容管理系统来引导新应用程序。
Throughout this guide, we’ll use travellist
as an example application, but you are free to change this to something else. The travellist
application will display a list of locations pulled from a local MySQL server, intended to demonstrate Laravel’s basic configuration and confirm that you’re able to connect to the database.
在本指南中,我们将使用travellist
作为示例应用程序,但是您可以随意将其更改为其他内容。 travellist
应用程序将显示从本地MySQL服务器提取的位置列表,以演示Laravel的基本配置并确认您能够连接到数据库。
First, go to your user’s home directory:
首先,转到用户的主目录:
The following command will create a new travellist
directory containing a barebones Laravel application based on default settings:
以下命令将基于默认设置创建一个新的travellist
目录,其中包含准系统Laravel应用程序:
composer create-project --prefer-dist laravel/laravel travellist
作曲者create-project --prefer-dist laravel / laravel travellist
You will see output similar to this:
您将看到类似于以下的输出:
Output
Installing laravel/laravel (v5.8.17)
- Installing laravel/laravel (v5.8.17): Downloading (100%)
Created project in travellist
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 80 installs, 0 updates, 0 removals
- Installing symfony/polyfill-ctype (v1.11.0): Downloading (100%)
- Installing phpoption/phpoption (1.5.0): Downloading (100%)
- Installing vlucas/phpdotenv (v3.4.0): Downloading (100%)
- Installing symfony/css-selector (v4.3.2): Downloading (100%)
...
When the installation is finished, access the application’s directory and run Laravel’s artisan
command to verify that all components were successfully installed:
安装完成后,访问应用程序的目录并运行Laravel的artisan
命令以验证是否成功安装了所有组件:
cd travellist
cd 旅行清单
You’ll see output similar to this:
您将看到类似于以下的输出:
Output
Laravel Framework 7.11.0
Usage:
command [options] [arguments]
Options:
-h, --help Display this help message
-q, --quiet Do not output any message
-V, --version Display this application version
--ansi Force ANSI output
--no-ansi Disable ANSI output
-n, --no-interaction Do not ask any interactive question
--env[=ENV] The environment the command should run under
-v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
...
This output confirms that the application files are in place, and the Laravel command-line tools are working as expected. However, we still need to configure the application to set up the database and a few other details.
此输出确认应用程序文件到位,并且Laravel命令行工具按预期工作。 但是,我们仍然需要配置应用程序以设置数据库和其他一些细节。
The Laravel configuration files are located in a directory called config
, inside the application’s root directory. Additionally, when you install Laravel with Composer, it creates an environment file. This file contains settings that are specific to the current environment the application is running, and will take precedence over the values set in regular configuration files located at the config
directory. Each installation on a new environment requires a tailored environment file to define things such as database connection settings, debug options, application URL, among other items that may vary depending on which environment the application is running.
Laravel配置文件位于应用程序根目录内名为config
的目录中。 另外,在将Laravel与Composer一起安装时,它会创建一个环境文件 。 该文件包含特定于应用程序正在运行的当前环境的设置,并且将优先于位于config
目录的常规配置文件中设置的值。 在新环境中进行的每次安装都需要一个定制的环境文件来定义诸如数据库连接设置,调试选项,应用程序URL之类的内容,这些其他内容可能会根据应用程序运行的环境而有所不同。
Warning: The environment configuration file contains sensitive information about your server, including database credentials and security keys. For that reason, you should never share this file publicly.
警告 :环境配置文件包含有关服务器的敏感信息,包括数据库凭据和安全密钥。 因此,您永远不应公开共享此文件。
We’ll now edit the .env
file to customize the configuration options for the current application environment.
现在,我们将编辑.env
文件,以自定义当前应用程序环境的配置选项。
Open the .env
file using your command line editor of choice. Here we’ll use nano
:
使用您选择的命令行编辑器打开.env
文件。 在这里,我们将使用nano
:
Even though there are many configuration variables in this file, you don’t need to set up all of them now. The following list contains an overview of the variables that require immediate attention:
即使此文件中有许多配置变量,您现在也不需要全部设置。 以下列表概述了需要立即注意的变量:
APP_NAME
: Application name, used for notifications and messages.
APP_NAME
:应用程序名称,用于通知和消息。
APP_ENV
: Current application environment.
APP_ENV
:当前应用程序环境。
APP_KEY
: Used for generating salts and hashes, this unique key is automatically created when installing Laravel via Composer, so you don’t need to change it.
APP_KEY
:用于生成盐和哈希,通过Composer安装Laravel时会自动创建此唯一密钥,因此您无需更改它。
APP_DEBUG
: Whether or not to show debug information at client side.
APP_DEBUG
:是否在客户端显示调试信息。
APP_URL
: Base URL for the application, used for generating application links.
APP_URL
:应用程序的基本URL,用于生成应用程序链接。
DB_DATABASE
: Database name.
DB_DATABASE
:数据库名称。
DB_USERNAME
: Username to connect to the database.
DB_USERNAME
:连接到数据库的用户名。
DB_PASSWORD
: Password to connect to the database.
DB_PASSWORD
:连接数据库的密码。
By default, these values are configured for a local development environment that uses Homestead, a prepackaged Vagrant box provided by Laravel. We’ll change these values to reflect the current environment settings of our example application.
默认情况下,这些值是为使用Homestead的本地开发环境配置的, Homestead是Laravel提供的预包装的Vagrant框。 我们将更改这些值以反映示例应用程序的当前环境设置。
In case you are installing Laravel in a development or testing environment, you can leave the APP_DEBUG
option enabled, as this will give you important debug information while testing the application from a browser. The APP_ENV
variable should be set to development
or testing
in this case.
如果要在开发或测试环境中安装Laravel,则可以将APP_DEBUG
选项保持启用状态,因为这将为您从浏览器测试应用程序时提供重要的调试信息。 在这种情况下,应将APP_ENV
变量设置为development
或testing
。
In case you are installing Laravel in a production environment, you should disable the APP_DEBUG
option, because it shows to the final user sensitive information about your application. The APP_ENV
in this case should be set to production
.
如果要在生产环境中安装Laravel,则应禁用APP_DEBUG
选项,因为它向最终用户显示有关应用程序的敏感信息。 在这种情况下, APP_ENV
应该设置为production
。
The following .env
file sets up our example application for development:
以下.env
文件设置了用于开发的示例应用程序:
Note: The APP_KEY
variable contains a unique key that was auto generated when you installed Laravel via Composer. You don’t need to change this value. If you want to generate a new secure key, you can use the php artisan key:generate
command.
注意 : APP_KEY
变量包含一个唯一密钥,该密钥是通过Composer安装Laravel时自动生成的。 您不需要更改此值。 如果要生成新的安全密钥,可以使用php artisan key:generate
命令。
APP_NAME=TravelList
APP_ENV=development
APP_KEY=APPLICATION_UNIQUE_KEY_DONT_COPY
APP_DEBUG=true
APP_URL=http://domain_or_IP
LOG_CHANNEL=stack
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=travellist
DB_USERNAME=travellist_user
DB_PASSWORD=password
...
Adjust your variables accordingly. When you are done editing, save and close the file to keep your changes. If you’re using nano
, you can do that with CTRL+X
, then Y
and Enter
to confirm.
相应地调整变量。 完成编辑后,保存并关闭文件以保留更改。 如果您使用的是nano
,则可以使用CTRL+X
,然后使用Y
和Enter
进行确认。
Your Laravel application is now set up, but we still need to configure the web server in order to be able to access it from a browser. In the next step, we’ll configure Nginx to serve your Laravel application.
现在,您的Laravel应用程序已设置,但是我们仍然需要配置Web服务器,以便能够从浏览器访问它。 在下一步中,我们将配置Nginx为您的Laravel应用程序提供服务。
We have installed Laravel on a local folder of your remote user’s home directory, and while this works well for local development environments, it’s not a recommended practice for web servers that are open to the public internet. We’ll move the application folder to /var/www
, which is the usual location for web applications running on Nginx.
我们已将Laravel安装在远程用户的主目录的本地文件夹上,虽然这对于本地开发环境非常有效,但对于向公共Internet开放的Web服务器,不建议这样做。 我们将应用程序文件夹移动到/var/www
,这是在Nginx上运行的Web应用程序的常用位置。
First, use the mv
command to move the application folder with all its contents to /var/www/travellist
:
首先,使用mv
命令将应用程序文件夹及其所有内容移动到/var/www/travellist
:
sudo mv ~/travellist /var/www/travellist
须藤MV〜/ travellist / var / www / travellist
Now we need to give the web server user write access to the storage
and cache
folders, where Laravel stores application-generated files:
现在,我们需要为Web服务器用户提供对storage
和cache
文件夹的写访问权,Laravel在其中存储应用程序生成的文件:
sudo chown -R www-data.www-data /var/www/travellist/storage
须藤chown -R www-data.www-data / var / www / travellist / storage
sudo chown -R www-data.www-data /var/www/travellist/bootstrap/cache
须藤chown -R www-data.www-data / var / www / travellist / bootstrap / cache
The application files are now in order, but we still need to configure Nginx to serve the content. To do this, we’ll create a new virtual host configuration file at /etc/nginx/sites-available
:
现在,应用程序文件已经整理好了,但是我们仍然需要配置Nginx来提供内容。 为此,我们将在/etc/nginx/sites-available
创建一个新的虚拟主机配置文件:
sudo nano /etc/nginx/sites-available/travellist
须藤纳米/ etc / nginx / sites-available / travellist
The following configuration file contains the recommended settings for Laravel applications on Nginx:
以下配置文件包含Nginx上Laravel应用程序的建议设置:
server {
listen 80;
server_name server_domain_or_IP;
root /var/www/travellist/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.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
Copy this content to your /etc/nginx/sites-available/travellist
file and, if necessary, adjust the highlighted values to align with your own configuration. Save and close the file when you’re done editing.
将此内容复制到您的/etc/nginx/sites-available/ travellist
文件中,并在必要时调整突出显示的值以符合您自己的配置。 完成编辑后,保存并关闭文件。
To activate the new virtual host configuration file, create a symbolic link to travellist
in sites-enabled
:
要激活新的虚拟主机配置文件,请在sites-enabled
创建指向travellist
的符号链接:
sudo ln -s /etc/nginx/sites-available/travellist /etc/nginx/sites-enabled/
sudo ln -s / etc / nginx / sites-available / travellist / etc / nginx / sites-enabled /
Note: If you have another virtual host file that was previously configured for the same server_name
used in the travellist
virtual host, you might need to deactivate the old configuration by removing the corresponding symbolic link inside /etc/nginx/sites-enabled/
.
注意 :如果您有另一个虚拟主机文件,该文件先前已配置为与travellist
虚拟主机中使用的相同的server_name
,则可能需要通过删除/etc/nginx/sites-enabled/
的相应符号链接来停用旧配置。
To confirm that the configuration doesn’t contain any syntax errors, you can use:
要确认配置不包含任何语法错误,可以使用:
You should see output like this:
您应该看到如下输出:
To apply the changes, reload Nginx with:
要应用更改,请使用以下命令重新加载Nginx:
Now go to your browser and access the application using the server’s domain name or IP address, as defined by the server_name
directive in your configuration file:
现在转到浏览器,使用服务器的域名或IP地址访问应用程序,该域名或IP地址由配置文件中的server_name
指令定义:
http://server_domain_or_IP
You will see a page like this:
您将看到如下页面:
That confirms your Nginx server is properly configured to serve Laravel. From this point, you can start building up your application on top of the skeleton provided by the default installation.
这确认您的Nginx服务器已正确配置为服务Laravel。 至此,您可以在默认安装提供的框架之上开始构建应用程序。
In the next step, we’ll modify the application’s main route to query for data in the database using Laravel’s DB
facade.
在下一步中,我们将修改应用程序的主要路线,以使用Laravel的DB
外观查询数据库中的DB
。
Assuming you’ve followed all the steps in this guide so far, you should have a working Laravel application and a database table named places
containing some sample data.
假设到目前为止,您已经按照本指南中的所有步骤进行操作,那么您应该有一个可运行的Laravel应用程序和一个名为places
的数据库表,其中包含一些示例数据。
We’ll now edit the main application route to query for the database and return the contents to the application’s view.
现在,我们将编辑主要的应用程序路由以查询数据库,并将内容返回到应用程序的view 。
Open the main route file, routes/web.php
:
打开主路由文件, routes/web.php
:
This file comes by default with the following content:
该文件默认带有以下内容:
Routes are defined within this file using the static method Route::get
, which receives a path and a callback function as arguments.
路由是使用静态方法Route::get
在此文件中定义的,该方法接收路径和回调函数作为参数。
The following code replaces the main route callback function. It makes 2 queries to the database using the visited
flag to filter results. It returns the results to a view named travellist
, which we’re going to create next. Copy this content to your routes/web.php
file, replacing the code that is already there:
以下代码替换了主路由回调函数。 它使用visited
标志对数据库进行2次查询以过滤结果。 它将结果返回到名为travellist
的视图中,接下来将要创建该视图。 将此内容复制到您的routes/web.php
文件中,替换已存在的代码:
$visited, 'togo' => $togo ] );
});
Save and close the file when you’re done editing. We’ll now create the view that will render the database results to the user. Create a new view file inside resources/views
:
完成编辑后,保存并关闭文件。 现在,我们将创建将数据库结果呈现给用户的视图。 在resources/views
内创建一个新的视图文件:
The following template creates two lists of places based on the variables visited
and togo
. Copy this content to your new view file:
以下模板根据visited
的变量和togo
创建两个场所列表。 将此内容复制到新的视图文件中:
Travel List
My Travel Bucket List
Places I'd Like to Visit
@foreach ($togo as $newplace)
- {{ $newplace->name }}
@endforeach
Places I've Already Been To
@foreach ($visited as $place)
- {{ $place->name }}
@endforeach
Save and close the file when you’re done. Now go to your browser and reload the application. You’ll see a page like this:
完成后,保存并关闭文件。 现在转到浏览器并重新加载应用程序。 您会看到这样的页面:
You have now a functional Laravel application pulling contents from a MySQL database.
您现在有了一个功能正常的Laravel应用程序,它从MySQL数据库中提取内容。
In this tutorial, you’ve set up a new Laravel application on top of a LEMP stack (Linux, Nginx, MySQL and PHP), running on an Ubuntu 20.04 server. You’ve also customized your default route to query for database content and exhibit the results in a custom view.
在本教程中,您已经在LEMP堆栈(Linux,Nginx,MySQL和PHP)之上建立了一个新的Laravel应用程序,该应用程序在Ubuntu 20.04服务器上运行。 您还自定义了默认路由,以查询数据库内容并将结果显示在自定义视图中。
From here, you can create new routes and views for any additional pages your application needs. Check the official Laravel documentation for more information on routes, views, and database support. If you’re deploying to production, you should also check the optimization section for a few different ways in which you can improve your application’s performance.
在这里,您可以为应用程序需要的任何其他页面创建新的路线和视图。 请查阅Laravel官方文档以获取有关路线 , 视图和数据库支持的更多信息。 如果要部署到生产环境,则还应该检查“ 优化”部分 ,以了解几种可以提高应用程序性能的不同方法。
翻译自: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-nginx-on-ubuntu-20-04