Browse Source

edited installation guide

tags/2.0.0-rc
Carsten Brandt 10 years ago
parent
commit
8b96f51fe0
  1. 36
      docs/guide/start-installation.md

36
docs/guide/start-installation.md

@ -13,10 +13,9 @@ Installing via Composer <a name="installing-via-composer"></a>
If you do not already have Composer installed, you may do so by following the instructions at If you do not already have Composer installed, you may do so by following the instructions at
[getcomposer.org](https://getcomposer.org/download/). On Linux and Mac OS X, you'll run the following commands: [getcomposer.org](https://getcomposer.org/download/). On Linux and Mac OS X, you'll run the following commands:
```
curl -s http://getcomposer.org/installer | php curl -s http://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer mv composer.phar /usr/local/bin/composer
```
On Windows, you'll download and run [Composer-Setup.exe](https://getcomposer.org/Composer-Setup.exe). On Windows, you'll download and run [Composer-Setup.exe](https://getcomposer.org/Composer-Setup.exe).
Please refer to the [Composer Documentation](https://getcomposer.org/doc/) if you encounter any Please refer to the [Composer Documentation](https://getcomposer.org/doc/) if you encounter any
@ -24,18 +23,16 @@ problems or want to learn more about Composer usage.
With Composer installed, you can install Yii by running the following command under a Web-accessible folder: With Composer installed, you can install Yii by running the following command under a Web-accessible folder:
```
composer create-project --prefer-dist yiisoft/yii2-app-basic basic composer create-project --prefer-dist yiisoft/yii2-app-basic basic
```
The above command installs Yii as a directory named `basic`. The above command installs Yii as a directory named `basic`.
> Tip: If you want to install the latest development version of Yii, you may use the following command, > Tip: If you want to install the latest development version of Yii, you may use the following command,
which adds a `stability` option: > which adds a [stability option](https://getcomposer.org/doc/04-schema.md#minimum-stability):
``` >
composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic > composer create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic
``` >
Note that the development version of Yii should not be used for production as it may break your running code. > Note that the development version of Yii should not be used for production as it may break your running code.
Installing from an Archive File <a name="installing-from-archive-file"></a> Installing from an Archive File <a name="installing-from-archive-file"></a>
@ -50,7 +47,7 @@ Installing Yii from an archive file involves two steps:
Other Installation Options <a name="other-installation-options"></a> Other Installation Options <a name="other-installation-options"></a>
-------------------------- --------------------------
The above installation instructions show how to install Yii, which also creates a basic Web application that works out of box. The above installation instructions show how to install Yii, which also creates a basic Web application that works out of the box.
This approach is a good starting point for small projects, or for when you just start learning Yii. This approach is a good starting point for small projects, or for when you just start learning Yii.
But there are other installation options available: But there are other installation options available:
@ -62,23 +59,23 @@ But there are other installation options available:
Verifying the Installation <a name="verifying-installation"></a> Verifying the Installation <a name="verifying-installation"></a>
---------------------- --------------------------
After installation, you can use your browser to access the installed Yii application with the following URL: After installation, you can use your browser to access the installed Yii application with the following URL:
``` ```
http://hostname/basic/web/index.php http://localhost/basic/web/index.php
``` ```
(This URL assumes you have installed Yii in a directory named `basic`, directly under the Web server document root directory, This URL assumes you have installed Yii in a directory named `basic`, directly under the Web server's document root directory,
and that the server name is `hostname`.) and that the Web server is running on your local machine(`localhost`), you may have to adjust it to your installation environment.
![Successful Installation of Yii](images/start-app-installed.png) ![Successful Installation of Yii](images/start-app-installed.png)
You should see the above "Congratulations!" page in your browser. If not, please check if your PHP installation satisfies You should see the above "Congratulations!" page in your browser. If not, please check if your PHP installation satisfies
Yii's requirements. You can check if the minimum requirements are met using one of the following approaches: Yii's requirements. You can check if the minimum requirements are met using one of the following approaches:
* Use a browser to access the URL `http://hostname/basic/requirements.php` * Use a browser to access the URL `http://localhost/basic/requirements.php`
* Run the following commands: * Run the following commands:
``` ```
@ -102,7 +99,7 @@ an [Apache HTTP server](http://httpd.apache.org/) or an [Nginx HTTP server](http
Windows, Mac OS X, or Linux. Windows, Mac OS X, or Linux.
On a production server, you may want to configure your Web server so that the application can be accessed On a production server, you may want to configure your Web server so that the application can be accessed
via the URL `http://hostname/index.php` instead of `http://hostname/basic/web/index.php`. Such configuration via the URL `http://www.example.com/index.php` instead of `http://www.example.com/basic/web/index.php`. Such configuration
requires pointing the document root of your Web server to the `basic/web` folder. You may also requires pointing the document root of your Web server to the `basic/web` folder. You may also
want to hide `index.php` from the URL, as described in the [URL Parsing and Generation](runtime-url-handling.md) section. want to hide `index.php` from the URL, as described in the [URL Parsing and Generation](runtime-url-handling.md) section.
In this subsection, you'll learn how to configure your Apache or Nginx server to achieve these goals. In this subsection, you'll learn how to configure your Apache or Nginx server to achieve these goals.
@ -142,7 +139,8 @@ DocumentRoot "path/to/basic/web"
### Recommended Nginx Configuration <a name="recommended-nginx-configuration"></a> ### Recommended Nginx Configuration <a name="recommended-nginx-configuration"></a>
You should have installed PHP as an [FPM SAPI](http://php.net/install.fpm) to use [Nginx](http://wiki.nginx.org/). You should have installed PHP as an [FPM SAPI](http://php.net/install.fpm) to use [Nginx](http://wiki.nginx.org/).
Use the following Nginx configuration, replacing `path/to/basic/web` with the actual path for `basic/web`. Use the following Nginx configuration, replacing `path/to/basic/web` with the actual path for `basic/web` and `mysite.local` with
the actual hostname to serve.
``` ```
server { server {
@ -156,8 +154,8 @@ server {
root /path/to/basic/web; root /path/to/basic/web;
index index.php; index index.php;
access_log /path/to/project/log/access.log main; access_log /path/to/basic/log/access.log main;
error_log /path/to/project/log/error.log; error_log /path/to/basic/log/error.log;
location / { location / {
# Redirect everything that isn't a real file to index.php # Redirect everything that isn't a real file to index.php

Loading…
Cancel
Save