惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
News and Events Feed by Topic
S
Security @ Cisco Blogs
S
Secure Thoughts
Attack and Defense Labs
Attack and Defense Labs
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hacker News: Front Page
博客园 - 叶小钗
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
Forbes - Security
Forbes - Security
AI
AI
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
罗磊的独立博客
Application and Cybersecurity Blog
Application and Cybersecurity Blog
爱范儿
爱范儿
GbyAI
GbyAI
The Last Watchdog
The Last Watchdog
TaoSecurity Blog
TaoSecurity Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
D
DataBreaches.Net
Recent Announcements
Recent Announcements
Schneier on Security
Schneier on Security
C
Cisco Blogs
美团技术团队
D
Docker
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
月光博客
月光博客
雷峰网
雷峰网
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
H
Hackread – Cybersecurity News, Data Breaches, AI and More
A
Arctic Wolf
B
Blog RSS Feed
Cisco Talos Blog
Cisco Talos Blog
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
V2EX - 技术
V2EX - 技术
Y
Y Combinator Blog
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
Security Archives - TechRepublic
Security Archives - TechRepublic
G
GRAHAM CLULEY
Jina AI
Jina AI
Hugging Face - Blog
Hugging Face - Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
The Hacker News
The Hacker News

博客园 - 马会东

Llama3 在HumanEval中的表现 在 Apple Silicon Mac(M1、M2 或 M3)上运行最新 LLM 模型 Meta Llama 3 的分步指南 centos8 yum 安装rabbitmq dotnet new 命令 ACE Editor(代码编辑器) 入门教程 在mac上使用docker部署Mongo数据库 如何在Curl中使用Socks5代理 知识付费平台 快速开发框架(管理系统-持续更新) mysql 索引优化原则总结(limit where in like ) MySQL高级知识——Order By关键字优化 mysql索引的排列顺序 解决MySQL使用limit偏移量较大效率慢的问题 tar命令详解 systemctl命令列出所有服务 Git的撤销、修改和回退命令 使用git时显示untracked files(未监控)解决办法 MySQL中Case When用法详解 计算机指令-流水线和吞吐率
mamp nginx thinkphp5 配置方法
马会东 · 2023-12-18 · via 博客园 - 马会东

thinkphp5的 nginx 配置,官方文档参考: http://static.kancloud.cn/manual/thinkphp5/177576

fastadmin的 nginx 配置,官方文档参考:https://doc.fastadmin.net/doc/faq.html

server {
        listen       80;
        server_name  www.fa.com *.fa.com;
        root   "C:/phpstudy/WWW/fastadmin/public";
        location / {
            index  index.html index.htm index.php;
            #主要是这一段一定要确保存在            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }
            #结束
            #autoindex  on;
        }
        location ~ .php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}

使用MAMP PRO配置的时候, 可以将location /规则添加到nginx的第一个文本框。

#主要是这一段一定要确保存在            if (!-e $request_filename) {
                rewrite  ^(.*)$  /index.php?s=/$1  last;
                break;
            }

第二段location是匹配的伪静态规则,需要修改对应的nginx配置。

如果直接添加到nginx配置界面的server部分,则会被追加到末尾,这就造成该规则不起作用

这里的server 额外添加的规则应该是解析静态资源目录的规则,如下:

location @rewrite {
        set $static 0;        if  ($uri ~ .(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css.map|min.map|mp3|wav|m4a)$) {
            set $static 1;
        }        if ($static = 0) {
            rewrite ^/(.*)$ /index.php?s=/$1;
        }
    }

下面才是真正修改伪静态规则的方法:

打开MAMP PRO ,菜单栏的 File -> Edit Template -> nginx, 修改大约196行开始,注释掉原来的 php解析规则,更改为:

location ~ .php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

保存,并重启nginx即可生效。