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
</IfModule>
RewriteEngine On
<Files .env>
Order allow,deny
Deny from all
</Files>
# 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}]
</IfModule>
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;
server_name example.com www.example.com;
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)(|/.*)$;
fastcgi_pass 127.0.0.1:9000;
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?
2
Answers
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 yournginx.conf
file and see if your site is utilising the correct root folder path.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 –
https://stackoverflow.com/a/70970178
References –
Just in case it helps anyone else with a 404 error using the Linux app service in azure:
Apparently nginx will return a 404 when Laravel has an error. The only evidence of this you will find is by sshing into the instance and looking in the Laravel storage folders logs.