Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Bhavya8181/723bd7e510bf230409b642812a02586b to your computer and use it in GitHub Desktop.
Save Bhavya8181/723bd7e510bf230409b642812a02586b to your computer and use it in GitHub Desktop.
setup & install require packege for setup laravel project in windows server iis
Ref Link
======================
youtube video
https://www.youtube.com/watch?v=YMMFfAad3y8
https://www.youtube.com/watch?v=1p985k-sGoc
Enable IIS windows
https://help.claris.com/en/server-installation-configuration-guide/content/enabling-iis-windows.html
Add CGI module
https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=services-configuring-cgi-gateway-iis-version-7-later
1. Base on laravel project version you should ensure that your web server has the following minimum PHP version and extensions: it will find from official website
https://laravel.com/docs/9.x/deployment#server-requirements (select your version and find server requirement on laravel.com official website)
2. Using Remote desktop connection login with your server credentials
3. Download Install Basic requirement Manager (downlaod all in your local pc specific drive and that drive share in your remote desktop and install in server windows)
==========================================
- download git from https://git-scm.com/downloads
- download composer from https://getcomposer.org/download/
- download node from https://nodejs.org/en/download/
- download PHP7.4 from https://windows.php.net/download/ (download version base on your requirements)
- download urlrewrite from (https://www.iis.net/downloads/microsoft/url-rewrite)
used to allow url rewrite. Without it url paths wont work. example.com/some_path
- [PHP Versions less then 7.1] WinCache https://sourceforge.net/projects/wincache/
- Win Acme (Use instead of certbot) https://www.win-acme.com/
used to enable HTTPS
4. Install Windos IIS server managger
======================================
- Open server manager
If server manager not found
-> go to optional features, click on add new features (view features button)
-> search RSAT Server manager (85mb around)
- click on manage & select add role & feature
- click on next & select Role-base....installation
- click on next
- Make sure select Web server (IIS) check box check and click on next
- after installation complete close the popup
After that go to your local pc and type your ip in chorme you can show basic windows server page
- Go to C/inetpub path and clone your project (also add your production .env file)
5. Install PHP + WinCache
================================
- create PHP folder with extension inside c: drive and extract downloaded php version and add path in system variable section of enviorment variable
- Install wincache inside c/WinCache drive
- Copy php_wincache.dll file from C/WinCache and paste inside php7.4/ext
6. Windows IIS FastCGI + Module Handler Setup
================================================
- Go to C/inetpub/wwwroot and create simple test.php file
- Then opne www://localhost/test.php (it will occur 403 not found because dont have file handler)
- open iis manager
- select EC2AMAZ.../Sites/Default Web site
Install CGI
--------------
- go to server manager
- go to manage in header and select add roles & fetures
- In server roles section select web server(IIS )(8 of 43 installd ) > expand web server (7 of 34 installed) > expan application development and check cgi and click on next next and istall
- After thet reopen iis manager you can show cgi option istalled
- Select handler mappings
- click on add module mapping..(on right sidebar)
- Request path: *.php
- Module: select FastCgiModule
- Executable: select your php cgi file (file path: c:/php7.4/php-cgi.exe)
- name: php-cgi & click on ok ok
- now re run www://localhost/test.php (your sample file will be run and show hello world)
7. Building Laravel Project
============================
- before build laravel install composer & node
- open command prompt and go to your project directory
- composer install (if ext-fileinfo requires then uncomment from php.ini)
- npm install
- php artisan key:generate
Install My SQLServer
=============================
- go to your local pc
- open dev.mysql.com/downloads/installer
- select microsoft windows in operation system dropdown
- and download second msi installer (download in those drive which is shred with your remote desktop)
- go to remote desktop and install
- select server only and click on next
- click on execute & next next
- In accout and role section add my sql root password and add user and click on next next and click on finished and then cancel
- Add c:/programfiles/mysql/mysql server 8.0/bin path in in system variable section of enviorment variable
- conect RDS Instant using below command
mysql -h production-database.c8t...rds.amazonaws.com -u admin -p
(if cant connect to my sql server error occur then it menns your ec2 not hvae access your ips for that create security grp or ec2 instanse in aws)
- create database in mysql
- php artisan migrate (if could not find drive then enable pdo_mysql extension in php.ini file and rerun migrate command)
8. Setting UP IIS Server
==========================
- open iis manager
- go to EC2A../Sites/Default web site
- Install urlwrite and again open iis manager and show url write option
- right click on sites option > add website
name: your website name
physical path: c:/intepub/yourproject/public
hostname: yourproject name
and create site
- select your site and go to default document and add index.php as a default document
- and remove all other file
- go to your local pc and run your project with ip and if 403 forbidden then follow below step
- in iis manager go to handler mapping and if cgi-exe is disabled then remove it
- click on add module mapping..(on right sidebar)
- Request path: *.php
- Module: select FastCgiModule
- Executable: select your php cgi file (file path: c:/php7.4/php-cgi.exe)
- name: php-cgi & click on ok ok
- go to c:/intepub
- open propeties of wwwroot and your project folder and go to security option
- selct iis_user(ec2...) from group/username dropdown in wwwroot folder
- on yourproject security option add iss user using below step
- click on edit and then click on add button
- Add name same as wwwroot user name (IIS_IUSER) and clcik on check name and click on ok
- add permission full controll
- Now check your projecy have session folder inside project/storage/framework folder
- Now go to your local pc and again check in chorme your site will successfully working
- if image and css not load then go to remote desktop
- open iis manager
- select your site/on right side select bindings/and click on add button
- add your host
- Install ssl cerficate & perfom below step
-> win-acme download client.
-> click on wacs.exe file.
-> create N for new certificate
-> asking for site 1 or 2 (normal or www)
=> click -> pick all bindings
- Auto redirect non ssl to ssl
-> open IIS server
-> Site right click -> manage website -> advance setting
-> expand HSTS
enable -> true
redirectr http to http -> true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment