Ana içeriğe geç

🔵 IIS (Windows)

Running Monitron SaaS on Windows with IIS is fully supported. This guide walks you through the complete setup.


📋 Onkosullar

  • Windows Server 2019/2022 or Windows 10/11
  • IIS 10+ with URL Rewrite Module
  • PHP 8.2+ installed (via Web Platform Installer or manually)

🔧 Step 1: Install IIS & PHP

Install IIS

  1. Open Server ManagerAdd Roles and Features
  2. Select Web Server (IIS)
  3. Under Role Services, enable:
    • ✅ Common HTTP Features → Static Content, Default Document
    • ✅ Application Development → CGI
    • ✅ Security → Request Filtering

Install PHP

  1. Download PHP 8.3 (Non Thread Safe) from windows.php.net
  2. Extract to C:\PHP
  3. Copy php.ini-production to php.ini
  4. Edit php.ini and enable required extensions:
extension_dir = "ext"
extension=bcmath
extension=curl
extension=fileinfo
extension=gd2
extension=mbstring
extension=openssl
extension=pdo_mysql ; or pdo_pgsql, pdo_sqlite
extension=sockets
extension=zip

Install URL Rewrite Module

Download and install from iis.net


📝 Step 2: Web.config

Create or verify the web.config file in public/:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- URL Rewriting for Laravel -->
<rewrite>
<rules>
<rule name="Redirect Trailing Slashes" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Redirect" url="{R:1}" redirectType="301" />
</rule>
<rule name="Send Requests To Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>

<!-- Block .env file access -->
<security>
<requestFiltering>
<hiddenSegments>
<add segment=".env" />
</hiddenSegments>
<fileExtensions>
<add fileExtension=".env" allowed="false" />
</fileExtensions>
</requestFiltering>
</security>

<!-- Default Document -->
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>

<!-- Custom Headers -->
<httpProtocol>
<customHeaders>
<add name="X-Frame-Options" value="SAMEORIGIN" />
<add name="X-Content-Type-Options" value="nosniff" />
<add name="X-XSS-Protection" value="1; mode=block" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

🌐 Step 3: Create the IIS Site

  1. Open IIS Manager
  2. Right-click SitesAdd Website
  3. Fill in:
AyarDeger
Site nameMonitron
Physical pathE:\monitron\public
Host nameyour-domain.com
Port80 (or 443 with SSL)
tehlike

Point to the public folder! NOT the root installation directory.


🔒 Step 4: Add SSL

  1. In IIS Manager, select your site
  2. Click BindingsAdd
  3. Set Type to https, port 443
  4. Select your SSL certificate

For free SSL, use win-acme (Let's Encrypt for Windows):

# Download and run win-acme
wacs.exe --target iis --siteid 1 --installation iis

⏰ Step 5: Scheduled Task (Cron Equivalent)

Windows uses Task Scheduler instead of cron:

  1. Open Task Scheduler
  2. Click Create Basic Task
  3. Name: Monitron Scheduler
  4. Trigger: Daily → set start time → Repeat every 1 minute for Indefinitely
  5. Action: Start a program
    • Program: C:\PHP\php.exe
    • Arguments: artisan schedule:run
    • Start in: E:\monitron

Or use PowerShell:

$action = New-ScheduledTaskAction -Execute "C:\PHP\php.exe" -Argument "artisan schedule:run" -WorkingDirectory "E:\monitron"
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1) -RepetitionDuration ([TimeSpan]::MaxValue)
Register-ScheduledTask -TaskName "Monitron Scheduler" -Action $action -Trigger $trigger -User "SYSTEM" -RunLevel Highest

🔄 Step 6: Queue Worker Service

Use NSSM to run the queue worker as a Windows service:

# Download NSSM from nssm.cc
nssm install MonitronWorker "C:\PHP\php.exe" "artisan queue:work --sleep=3 --tries=3 --max-time=3600"
nssm set MonitronWorker AppDirectory "E:\monitron"
nssm set MonitronWorker Start SERVICE_AUTO_START
nssm start MonitronWorker

🛠️ Sorun Giderme

500.19 Internal Server Error

The URL Rewrite module isn't installed:

# Install via Web Platform Installer or download from iis.net

PHP not processing

Make sure PHP is configured as a handler in IIS:

  1. Select your site → Handler Mappings
  2. Add Module Mapping: *.phpFastCgiModuleC:\PHP\php-cgi.exe

Permission issues

Give IIS_IUSRS Modify permission on:

  • storage/
  • bootstrap/cache/