企业实战项目Linux+nginx+php+mysql+redis部署web服务2.0
由于公司开发使用的是thinkphp框架,之前文档的nginx配置无法很好的支持。
如果你也遇到这个问题那么将你的nginx.conf修改为如下
注意:以下配置加在 server{}中
location "/"的配置
location / { root html; index index.php index.html index.htm; if (!-e $request_filename) { rewrite ^(.*)$ /index.php?s=$1 last; break; } }
fastcgi配置
注意:如果你的fastcgi配置,location匹配写的是 location ~ \.php$,需要把"$"去掉
location ~ \.php { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_cache cache_fastcgi; fastcgi_cache_valid 200 302 1h; fastcgi_cache_valid 301 1d; fastcgi_cache_valid any 1m; fastcgi_cache_min_uses 1; fastcgi_cache_use_stale error timeout invalid_header http_500; set $real_script_name $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") { set $real_script_name $1; set $path_info $2; } fastcgi_cache_key http://$host$request_uri; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
原文地址:https://blog.51cto.com/13434336/2487082
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。