Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 Not Found #4481

Open
taepp-do opened this issue Jan 31, 2025 · 3 comments
Open

404 Not Found #4481

taepp-do opened this issue Jan 31, 2025 · 3 comments
Labels
Support Need support? Start here. Issues will be closed if not a bug.
Milestone

Comments

@taepp-do
Copy link

I installed cachet in Azure on a Web App with Mysql db. when i access my link.com/cachet/public i get to the status page, when I click on dashboard it takes me to link.com/dashboard 404 Not found. If I copy the public to my wwwroot ad access link.com/public and then dashboard its the same thing.

Could someone help me please with that? Thanks

@jbrooksuk
Copy link
Member

I'm afraid I'm not familiar with hosting Laravel apps on Azure, but a quick Google search might help here.

https://stackoverflow.com/questions/69461833/how-to-deploy-an-app-service-in-azure-with-laravel-8-and-php-8-without-public-en

If you manage to get this working, I'd love to get the documentation updated too, if you could contribute that?

@jbrooksuk jbrooksuk added the Support Need support? Start here. Issues will be closed if not a bug. label Feb 1, 2025
@jbrooksuk jbrooksuk added this to the v3.x milestone Feb 1, 2025
@taepp-do
Copy link
Author

taepp-do commented Feb 1, 2025

Yes so I solved it. It was kinda nerve wracking but finally I got it working.

So for an Azure docu. you need to change/add this:

bootstrap/app.php

use Illuminate\Http\Request; // Korrekte Klasse importieren

->withMiddleware(function (Middleware $middleware) {
// Bestehende Middleware-Einstellungen
$middleware->redirectGuestsTo(fn () => route('login'));
$middleware->redirectUsersTo(AppServiceProvider::HOME);
$middleware->throttleApi();

// TrustProxies-Middleware hinzufügen
$middleware->trustProxies(at: [
    '0.0.0.0/0', // Vertraue allen Proxies (für Azure Web Apps oder ähnliche Umgebungen)
]);

$middleware->trustProxies(headers: Request::HEADER_X_FORWARDED_FOR |
    Request::HEADER_X_FORWARDED_HOST |
    Request::HEADER_X_FORWARDED_PORT |
    Request::HEADER_X_FORWARDED_PROTO |
    Request::HEADER_X_FORWARDED_AWS_ELB
);

})

config/database.php
database.php

'options' => extension_loaded('pdo_mysql') ? [
PDO::MYSQL_ATTR_SSL_CA => env('DB_SSL_CA'),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('DB_SSL_VERIFY', true),
] : [],
'options' => extension_loaded('pdo_mysql') ? [
PDO::MYSQL_ATTR_SSL_CA => env('DB_SSL_CA'),
PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => env('DB_SSL_VERIFY', true),
] : [],

and download the certificate for ssl (the link is from microsoft):
wget https://dl.cacerts.digicert.com/DigiCertGlobalRootCA.crt.pem

from your stackoverflow you need to do this:
cp /etc/nginx/sites-available/default /home/site/default

Now edit the /home/site/default file and update as described in laravel documentation Server Configuration settings

change to root to:
root /home/site/wwwroot/cachet/public;

and

location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$query_string;
}

custom startup script

You will now need to create a custom startup script and save the file as /home/site/startupscriptbymoon.sh

Add following commands in above file

cp /home/site/default /etc/nginx/sites-available/default
service nginx reload
Startup Command and Test

Now navigate back to your App Service via the Azure Portal. Under the Settings section, select Configuration and then General Settings.

In Startup Command text box enter the following:

/home/site/startupscriptbymoon.sh

I think thats all, hope it helps. Also Thank you so much for that stackoverflow page.

@taepp-do
Copy link
Author

taepp-do commented Feb 2, 2025

@jbrooksuk problem is solved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Support Need support? Start here. Issues will be closed if not a bug.
Projects
None yet
Development

No branches or pull requests

2 participants