Thứ Sáu, 14 tháng 10, 2016

Laravel 5 Tutorial : Installing Laravel 5.3 on Windows with IIS


Laravel 5 Tutorial - This Lessons will show you how to install Laravel 5.3 on windows using Microsoft Internet Information Services (IIS) Manager. We will enable Microsoft Internet Information Services (IIS) on windows 10, and install PHP 7 for IIS.

After installed laravel, for next lessons we will try configuration to connect to a SQLite database.

Installing Laravel 5.3 on Windows with IIS

In windows 10, IIS (Internet Information Services) needs to be installed, One way to do this is by selecting the start button and type Windows Features to bring up a list where "Turn Windows features on or off" can be selected.

Installing Laravel 5.3 on Windows with IIS

Another way to get to this Control Panel app is Windows + R key combination and run "appwiz.cpl". Turn Windows features on or off link should be in the upper left panel.

install laravel on windows with IIS

PHP and PHP Manager

Install PHP 7 for Windows using the Microsoft Web Platform Installer. Download Microsoft web Platform Installer here.

It's an easy way to get both PHP for IIS and takes some of the guess work out of getting PHP up and running on Windows and IIS.

install laravel on windows with IIS

Download and Install PHP Manager

To install PHP manager and running in windows with IIS, please download and install PHP Manager below :

PHP Manager 1.4 for IIS 10

PHP Manager 1.3 for IIS 8-8.5

Composer for Windows

To install Laravel on windows with Internet Information Services, you need to install composer, see How to Install Composer on Windows.

Create Laravel Project

Open your Command Prompt (CMD) with "Open as Administrator". One way to do this is by selecting the start button  and type command to bring up a list where "Command Prompt" can be selected. Right click on Command Prompt and select Run as administrator.

cd c:/intepub
......
composer create-project laravel/laravel laravel "5.3.*"

To install Laravel on windows with Xampp PHP server, go to this link.

IIS Manager Configurations

Open Internet Information Services (IIS) Manager. Right click on the Server and select Add Website. Fill out the form as follows :
Site name : Laravel in IIS
Application pool : DefaultAppPool
Physical path: C:\inetpub\laravel
Host name : laravel.win
Select "Test Settings" and then "OK" if successful.

Hosts Mapping

Since the Host name laravel.win was entered for the website, the hosts file needs to be updated. Open Notepad as an administrator. One way to do this is by selecting the start button  and type Notepad to bring up a list where it can be selected. Right click on Notepad and select Run as administrator.

Select File | Open, or Ctrl + O and change the File type from Text Documents (*.txt) to All Files (*.*). Browse to C:\Windows\System32\drivers\etc and select the hosts file. Add an entry to map localhost to laravel.win as follows.

127.0.0.1   localhost
127.0.0.1   laravel.win

Laravel Project Permissions

Go to IIS Manager, Click on website "Laravel with IIS", right click on Edit Permissions. Under the Security tab, grant full control of the storage folder to Users as shown in the figure below.

install laravel on windows with IIS

Laravel web.config

Since IIS does not have an .htaccess file like Apache, create a web.config file in C:\inetpub\laravel\public as follows.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Restart IIS

In an Administrative Command Prompt, restart IIS so all of the changes get applied.

iisreset /restart

Open Laravel Project

Finally, try to open your first Laravel intalled on IIS, following by this command

http://laravel.win/public

Video Tutorial Installing Laravel 5.3 on Windows with IIS



See you Next Lessons....

Không có nhận xét nào:

Đăng nhận xét