我在kali上安装了Nginx服务器,并通过在浏览器中输入localhost来访问它。然后我安装Adminer以便以图形方式管理我的数据库,但是当我在浏览器中输入http://localhost/adminer时,我会收到一个404 Not found。
我不知道我在哪里错过了!
这是我的/etc/nginx/sites-available的内容
server {
listen 80 default_server;
listen [::]:80 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
root /usr/share/adminer;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
# pass PHP scripts to FastCGI server
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php-fpm (or other unix sockets):
fastcgi_pass unix:/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;
#}
}以下是/log/nginx/error.log的内容
2020/09/02 07:43:47 [error] 71583#71583: *1 "/usr/share/nginx/html/adminer/index.html" is
not found (2: No such file or directory), client: ::1, server: , request: "GET /adminer/
HTTP/1.1", host: "localhost"根据错误消息,它的/usr/share/nginx/html目录不包含adminer文件夹,这是真的,因为我在那个位置没有这个文件夹。所以我不知道Nginx为什么在那里寻找它,或者它是否应该在那里;如果是,为什么它不在那里?我该如何解决这个问题?
发布于 2020-11-27 17:30:44
Nginx正在寻找不是根指令的路径中的“index.html”,这是事实:"/usr/share/nginx/html/adminer/index.html“没有找到。
执行以下步骤,可以轻松地修复它:
如果您的文件系统中没有此路径:“/usr// adminer”,创建它,因为它是您在conf文件中的根文件。
。
index index.php index.html index.htm index.nginx-debian.html;
sudo ln -s /etc/nginx/sites现有/you.conf /etc/nginx/sites-enabled/
完成,重新加载服务器,一切都会好起来。
发布于 2022-04-15 01:37:48
Adminer是基于adminer.php的。您需要将adminer.php放在index指令处。为我解决了。
https://stackoverflow.com/questions/63700642
复制相似问题