404 Not Found nginx/1.18.0 (Ubuntu) при развертывании django в aws
Я пытаюсь развернуть проект django на aws, используя любой сервер nginx (и базу данных aws RDS mysql). После настройки я получаю ошибку 404 Not Found nginx/1.18.0 (Ubuntu)
. Когда я пытаюсь получить доступ к любой странице приложения, кроме url для домашней страницы (/). То есть, я могу получить доступ только к базовому url, остальные показывают page not found
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm index.nginx-debian.html;
server_name ip_address;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
include proxy_params;
proxy_pass http://unix:/var/www/html/django/app.sock;
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
location /phpmyadmin/{
root /usr/share/;
index index.php;
try_files $uri $uri/ =404;
}
location /static/ {
autoindex on;
alias /var/www/html/django/staticfiles/;
proxy_pass http://unix:/var/www/html/django/app.sock;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.4-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;
}
}
Я разработал приложение локально, и эта ошибка кажется мне странной. Я могу получить доступ ко всем страницам сайта в разработке, но только к главной странице в производстве. Что я делаю не так?