I Have Laravel Rest Api for mobile app running under ubuntu – nginx and every thing is working just fine till today, woke up and users can’t access the api and I check nginx error log and found below
2021/04/18 01:21:52 (error) 2772#2772: *138808 directory index of "/var/www/html/mydomain/public/" is forbidden, client: 9x.1x.1x.5x, server: mydomain.com, request: "GET / HTTP/1.>
2021/04/17 23:16:01 (error) 2772#2772: *138792 directory index of "/var/www/html/mydomain/public/" is forbidden, client: 4x.15x.20x.2x1, server: mydomain.com, request: "GET /?XDEBUG>
this is my Nginx config :
server {
root /var/www/html/mydomain/public;
# Add index.php to the list if you are using PHP
index index.php;
server_name mydomain.com www.mydomain.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.php?$query_string;
}
# pass PHP scripts to FastCGI server
#
location ~ .php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /.ht {
deny all;
}
listen (::):443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/mydomain.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.mydomain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = mydomain.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
listen (::):80;
server_name mydomain.com www.mydomain.com;
return 404; # managed by Certbot
No one changed any thing on the server side and it was working, what is the issue here
Appreciate any help and ideas this is a live project