Skip to content

Commit 2ae35d8

Browse files
authored
翻译完成
1 parent 897ead3 commit 2ae35d8

File tree

1 file changed

+46
-41
lines changed

1 file changed

+46
-41
lines changed

installation.md

Lines changed: 46 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# Laravel 安装指南
22

3-
- [Installation](#installation)
4-
- [Server Requirements](#server-requirements)
5-
- [Installing Laravel](#installing-laravel)
6-
- [Configuration](#configuration)
7-
- [Web Server Configuration](#web-server-configuration)
8-
- [Pretty URLs](#pretty-urls)
3+
- [安装](#installation)
4+
- [服务器要求](#server-requirements)
5+
- [安装 Laravel](#installing-laravel)
6+
- [配置](#configuration)
7+
- [Web 服务器配置](#web-server-configuration)
8+
- [优雅链接](#pretty-urls)
99

1010
<a name="installation"></a>
11-
## Installation
11+
## 安装
1212

13-
> {video} Are you a visual learner? Laracasts provides a [free, thorough introduction to Laravel](https://laracasts.com/series/laravel-from-scratch-2017) for newcomers to the framework. It's a great place to start your journey.
13+
> {video} 你是一个喜欢看视频的学习者么? Laracasts 为刚刚使用这个框架的新手们提供了一个 [免费、深入的 Laravel视频](https://laracasts.com/series/laravel-from-scratch-2017) 。这是一个开始你学习之途的好地方。
1414
1515
<a name="server-requirements"></a>
16-
### Server Requirements
16+
### 服务器要求
1717

18-
The Laravel framework has a few system requirements. Of course, all of these requirements are satisfied by the [Laravel Homestead](/docs/{{version}}/homestead) virtual machine, so it's highly recommended that you use Homestead as your local Laravel development environment.
18+
Laravel 框架会有一些系统上的要求。当然,这些要求在 [Laravel Homestead](/docs/{{version}}/homestead) 虚拟机上都已经完全配置好了。所以,非常推荐你使用 Homestead 作为你的本地 Laravel 开发环境。
1919

20-
However, if you are not using Homestead, you will need to make sure your server meets the following requirements:
20+
然而,如果你没有使用 Homestead ,你需要确保你的服务器上安装了下面的几个拓展:
2121

2222
<div class="content-list" markdown="1">
2323
- PHP >= 5.6.4
@@ -29,62 +29,63 @@ However, if you are not using Homestead, you will need to make sure your server
2929
</div>
3030

3131
<a name="installing-laravel"></a>
32-
### Installing Laravel
32+
### 安装 Laravel
3333

34-
Laravel utilizes [Composer](https://getcomposer.org) to manage its dependencies. So, before using Laravel, make sure you have Composer installed on your machine.
34+
Laravel 使用 [Composer](https://getcomposer.org) 来管理代码依赖。所以,在使用 Laravel 之前,请先确认你的电脑上安装了 Composer
3535

36-
#### Via Laravel Installer
36+
#### 通过 Laravel 安装工具
3737

38-
First, download the Laravel installer using Composer:
38+
首先,使用 Composer 下载 Laravel 安装包:
3939

4040
composer global require "laravel/installer"
4141

42-
Make sure to place the `$HOME/.composer/vendor/bin` directory (or the equivalent directory for your OS) in your $PATH so the `laravel` executable can be located by your system.
42+
请确保 `$HOME/.composer/vendor/bin` 目录(或者是你操作系统对应的目录)在你的 $PATH 环境变量中,只有这样系统才能找到 `laravel` 的执行文件。
4343

44-
Once installed, the `laravel new` command will create a fresh Laravel installation in the directory you specify. For instance, `laravel new blog` will create a directory named `blog` containing a fresh Laravel installation with all of Laravel's dependencies already installed:
44+
一旦安装完成,就可以使用` laravel new `命令在指定目录创建一个新的 Laravel 项目,例如:`laravel new blog `将会在当前目录下创建一个叫` blog `的目录,此目录里面存放着新安装的 Laravel 和代码依赖。
4545

4646
laravel new blog
4747

48-
#### Via Composer Create-Project
48+
#### 通过 Composer Create-Project
4949

50-
Alternatively, you may also install Laravel by issuing the Composer `create-project` command in your terminal:
50+
除此之外,你也可以通过 Composer 在命令行运行 `create-project` 命令来安装 Laravel:
5151

5252
composer create-project --prefer-dist laravel/laravel blog
5353

54-
#### Local Development Server
54+
#### 本地开发服务器
5555

56-
If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the `serve` Artisan command. This command will start a development server at `http://localhost:8000`:
56+
如果你本地安装了 PHP,并且你想使用 PHP 内建的开发服务器来启动你的应用,你应该使用 Artisan 的 `serve` 命令。这个命令将会启动一个开发服务器在 `http://localhost:8000`:
5757

5858
php artisan serve
5959

60-
Of course, more robust local development options are available via [Homestead](/docs/{{version}}/homestead) and [Valet](/docs/{{version}}/valet).
60+
当然,更稳定的本地开发选项比如 [Homestead](/docs/{{version}}/homestead) [Valet](/docs/{{version}}/valet)
6161

6262
<a name="configuration"></a>
63-
### Configuration
63+
### 配置
6464

65-
#### Public Directory
65+
#### 公告目录
6666

67-
After installing Laravel, you should configure your web server's document / web root to be the `public` directory. The `index.php` in this directory serves as the front controller for all HTTP requests entering your application.
67+
在安装 Laravel 之后,你需要配置你的 Web 服务器的根目录为 `public` 目录。 这个目录的 `index.php` 文件作为所有 HTTP 请求进入应用的前端处理器。
6868

69-
#### Configuration Files
69+
#### 配置文件
7070

71-
All of the configuration files for the Laravel framework are stored in the `config` directory. Each option is documented, so feel free to look through the files and get familiar with the options available to you.
71+
Laravel 框架所有的配置文件都存放在 `config` 目录下。每个选项都被加入文档,所以你可以自由的浏览文件,轻松的熟悉你的选项。
7272

73-
#### Directory Permissions
73+
#### 目录权限
7474

75-
After installing Laravel, you may need to configure some permissions. Directories within the `storage` and the `bootstrap/cache` directories should be writable by your web server or Laravel will not run. If you are using the [Homestead](/docs/{{version}}/homestead) virtual machine, these permissions should already be set.
75+
安装 Laravel 之后, 你需要配置一些权限 。 `storage` `bootstrap/cache` 目录应该允许你的 Web 服务器写入,否则 Laravel 将无法写入。如果你使用 [Homestead](/docs/{{version}}/homestead) 虚拟机,这些权限应该已经被设置好了。
7676

77-
#### Application Key
77+
#### 应用程序密钥
7878

79-
The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the `php artisan key:generate` command.
79+
在你安装完 Laravel 后,首先需要做的事情是设置一个随机字符串的密钥。假设你是通过 Composer 或是 Laravel 安装工具安装的 Laravel,那么这个密钥已经通过 `key:generate` 命令帮你设置完成。
8080

81-
Typically, this string should be 32 characters long. The key can be set in the `.env` environment file. If you have not renamed the `.env.example` file to `.env`, you should do that now. **If the application key is not set, your user sessions and other encrypted data will not be secure!**
81+
通常这个密钥会有 32 字符长。这个密钥可以被设置在 .env 环境文件中。如果你还没将 .env.example 文件重命名为 .env,那么你现在应该去设置下。**如果你没有设置应用程序密钥,你的用户 Session 和 其他加密数据将不安全!**
8282

83-
#### Additional Configuration
8483

85-
Laravel needs almost no other configuration out of the box. You are free to get started developing! However, you may wish to review the `config/app.php` file and its documentation. It contains several options such as `timezone` and `locale` that you may wish to change according to your application.
84+
#### 额外配置
8685

87-
You may also want to configure a few additional components of Laravel, such as:
86+
Laravel 几乎不需做任何其它设置就可以马上使用,但是建议你先浏览 `config/app.php` 文件和对应的文档,这里面包含着一些选项,如 `时区``语言环境`,你可以根据应用程序的情况来修改。
87+
88+
你也可以设置 Laravel 的几个附加组件,像是:
8889

8990
<div class="content-list" markdown="1">
9091
- [Cache](/docs/{{version}}/cache#configuration)
@@ -93,16 +94,18 @@ You may also want to configure a few additional components of Laravel, such as:
9394
</div>
9495

9596
<a name="web-server-configuration"></a>
96-
## Web Server Configuration
97+
## Web 服务器配置
9798

9899
<a name="pretty-urls"></a>
99-
### Pretty URLs
100+
### 优雅连接
100101

101102
#### Apache
102103

103-
Laravel includes a `public/.htaccess` file that is used to provide URLs without the `index.php` front controller in the path. Before serving Laravel with Apache, be sure to enable the `mod_rewrite` module so the `.htaccess` file will be honored by the server.
104+
Laravel 框架通过 `public/.htaccess `文件来让 URL 不需要` index.php `即可访问。在 Apache 中使用 Laravel 之前,应当确保开启了 `mod_rewrite`模块,来保证 `.htaccess` 文件发挥作用
105+
106+
104107

105-
If the `.htaccess` file that ships with Laravel does not work with your Apache installation, try this alternative:
108+
如果 Laravel 附带的 `.htaccess `文件在 Apache 中无法使用的话,请尝试下方的做法:
106109

107110
Options +FollowSymLinks
108111
RewriteEngine On
@@ -113,10 +116,12 @@ If the `.htaccess` file that ships with Laravel does not work with your Apache i
113116

114117
#### Nginx
115118

116-
If you are using Nginx, the following directive in your site configuration will direct all requests to the `index.php` front controller:
119+
如果你使用 Nginx ,在你的网站配置中加入下述代码将会转发所有的请求到 `index.php` 前端控制器。
117120

118121
location / {
119122
try_files $uri $uri/ /index.php?$query_string;
120123
}
121124

122-
Of course, when using [Homestead](/docs/{{version}}/homestead) or [Valet](/docs/{{version}}/valet), pretty URLs will be automatically configured.
125+
如果你使用了 [Homestead](/docs/{{version}}/homestead)[Valet](/docs/{{version}}/valet) 的话,它将会自动的帮你设置好优雅链接。
126+
127+

0 commit comments

Comments
 (0)