Laradocker 环境下,访问网站后台出现“Not Found”错误,如何解决?
laradocker nginx 配置:访问网站后台问题解决
在使用 laradocker 环境进行配置时,访问网站后台可能遇到如下问题:
页面显示:
not found the requested url /admin was not found on this server.
解决方案:
要解决此问题,需要修改 laradocker/nginx/sites/app.conf 文件中的相关配置。具体修改如下:
location ~ \.php$ { # try_files $uri /index.php =404; fastcgi_pass php-upstream; fastcgi_index index.php; fastcgi_buffers 16 16k; fastcgi_buffer_size 32k; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fixes timeouts fastcgi_read_timeout 600; include fastcgi_params; } location /admin.php { fastcgi_pass php-upstream; fastcgi_param SCRIPT_FILENAME /var/www/your_directionary/admin.php; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; }
其中:
- 将文件中的 /admin 替换为项目的实际后台目录,例如 /laravel-website/routes/admin.php
- 根据实际项目的后台目录路径,将 /var/www/your_directionary/admin.php 替换为正确的路径
完成后,保存文件,重启 nginx,即可正常访问网站后台。
以上就是Laradocker 环境下,访问网站后台出现“Not Found”错误,如何解决?的详细内容,更多请关注其它相关文章!