I am deploying a laravel application inside windows based docker container using IIS. When I run the application after running docker container the server.php page present at C:\inetpub\wwwroot works fine. However, C:\inetpub\wwwroot\public\index.php returns 500 error. I have enabled the logs, run composer update and applied directory permissions as well. But still no luck.
IIS10 PHP 7.0 Laravel 5.5
The log message is
GET /public/index.php - 80 - 172.18.224.1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 500 19 13 1
web.config file:
<configuration>
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<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>
If you have a 500 Server Error, just rename the ". env. example" to ". env" and run: – php artisan key:generate – php artisan cache:clear – php artisan config:clear In my case, I pulled the project to Github repo to local machine.
If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.
From the top of my head, these are the errors that I faced when setting up laravel:
1- Directory storage permissions
2- Directory bootstrap permissions
3- composer update
4- .env file is available
5- .env key is generated
6- database is there
7- database is configured correctly in .env
8- php artisan serve
if the virtual server not configured
and if i got any of those i restart the server to update the values.
if the application was a repo and gave an error, sometimes the below artisan commands save the day:
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan view:clear
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With