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脚本,并将查询字符串传递给它。

相关推荐
武文斌772 小时前
arm启动代码总结
arm开发·嵌入式硬件·学习
荣光波比3 小时前
Nginx 实战系列(七)—— Nginx一键安装脚本详解
运维·nginx·自动化·云计算
ShiMetaPi5 小时前
操作【GM3568JHF】FPGA+ARM异构开发板 使用指南:蓝牙
arm开发·嵌入式硬件·fpga开发·rk3568
Linux运维技术栈6 小时前
域名网页加载慢怎么解决:从测速到优化的全链路性能优化实战
运维·网络·nginx·性能优化·cloudflare
明天见~~7 小时前
ARM 体系结构与存储器
arm开发
leo__5207 小时前
在Ubuntu 22.04系统中无需重启设置静态IP地址
tcp/ip·ubuntu·php
荣光波比8 小时前
Nginx 实战系列(六)—— Nginx 性能优化与防盗链配置指南
运维·nginx·性能优化·云计算
一川月白70910 小时前
ARM架构---指令集分类、内核组成,RAM与ROM的分类、工作模式、异常处理机制、立即数、s后缀、指令说明、汇编和 C 函数的相互调用
arm开发·函数调用·工作模式·arm内核·risc与cisc·s后缀·立即数
qq_3129201110 小时前
Nginx限流与防爬虫与安全配置方案
运维·爬虫·nginx·安全
从零开始的ops生活12 小时前
【Day 50 】Linux-nginx反向代理与负载均衡
linux·nginx