Azure web app laravel api – nginx error 404

All we need is an easy explanation of the problem, so here it is.

I’m getting 404 Not Found nginx/1.14.2 on my azure web app.
I’m using azure web app service connected to the azure MySQL database.

I can’t find the problem that causes my API routes to respond as a 404 error.

I checked most of the answers and I don’t really get it because I’m new to azure server configuration.
I used ssh to access my files and I don’t have an idea how to fix such a problem…

Those are my files like so:
.htaccess in public is :

Options -Indexes
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews

    RewriteEngine On

<Files .env>
    Order allow,deny
    Deny from all

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

default in /etc/nginx/sites-enabled

server {
    #proxy_cache cache;
        #proxy_cache_valid 200 1s;
    listen 8080;
    listen [::]:8080;
    root /home/site/wwwroot/public;
    index  index.php index.html index.htm;

    location / {
        index  index.php index.html index.htm hostingstart.html;
    location /snow/api {
        root /var/www/html/snow/pubic;
        try_files $uri $uri/ /index.php?$query_string;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /html/;

    # Disable .git directory
    location ~ /\.git {
        deny all;
        access_log off;
        log_not_found off;

    # Add locations of phpmyadmin here.
location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_connect_timeout         300;
        fastcgi_send_timeout           3600;
        fastcgi_read_timeout           3600;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 4 256k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
} ```

What am I missing?

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

  • The 404 error basically means that your or your visitor’s web browser was able to connect to the website server or host successfully. But, the requested resource, such as a filename or a specific URL, could not be found.
  • If you’re getting a 404 Not Found Nginx error and you’ve double-checked that the asset(s) exists on your server, it’s possible that your configuration file is the problem. To verify this, open your nginx.conf file and see if your site is utilising the correct root folder path.
  • It’s possible that it is showing a 404 Not Found Nginx error because the path is incorrect. Also, double-check your configuration file’s rewrite rules to make sure they aren’t misconfigured.

Check this similar SO thread workaround –

References –

  1. PHP 8 on Azure App Service
  2. Deploying PHP 8.0 applications with Azure App Service

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply