dnmp运行时404报错

dnmp运行时404报错

问题截图:

dnmp简介

M1芯片(Arm CPU) 环境中搭建PHP+NGINX+MYSQL的利器,docker容器管理当前使用的软件,可以简单安装软件和扩展。

localhost.conf 原始文件如下:

shell 复制代码
server {
    listen       80;
    server_name  xx.com;
    root   /www/xx/web;
    index  index.php index.html index.htm;
    #charset koi8-r;

    access_log /dev/null;
    #access_log  /var/log/nginx/nginx.localhost.access.log  main;
    error_log  /var/log/nginx/nginx.localhost.error.log  warn;

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ [^/]\.php(/|$) {
        fastcgi_pass   php56:9000;
        include        fastcgi-php.conf;
        include        fastcgi_params;
    }

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

添加如下代码片段:

powershell 复制代码
location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

上述位置块使用try_files指令来查找与请求中的URI匹配的文件,如果该文件不存在,则通过向URI添加'/'并尝试在其后查找一个目录来实现。最后,如果前两个过程都失败了,则Nginx将发起一个内部重定向到URI包含的PHP脚本,并将查询字符串传递给它。

相关推荐
dream_ready1 小时前
linux安装nginx+前端部署vue项目(实际测试react项目也可以)
前端·javascript·vue.js·nginx·react·html5
Ja_小浩2 小时前
【计算机网络】理解应用层协议HTTP
计算机网络·http·php
星尘安全3 小时前
一种新的电子邮件攻击方式:AiTM
开发语言·网络安全·php·网络钓鱼·aitm
汪公子4928 小时前
使用k8s搭建mariadb+nginx+wordpress
数据库·nginx·mariadb
向宇it11 小时前
FastAdmin列表用echats渲染,使用表格的templateView实现一个图表渲染的功能
php·web·fastadmin
周末不下雨15 小时前
正点原子阿尔法ARM开发板-IMX6ULL(五)——IMX启动方式
arm开发
吃饭只吃七分饱19 小时前
arm开发板通信
arm开发·c#
Flying_Fish_roe21 小时前
linux-网络管理-网络配置
linux·网络·php
运维小白。。21 小时前
Nginx 反向代理
运维·服务器·nginx·http