时间:2021-05-19
概述
Nginx服务器现在已经成为相当流行的开源Web服务器,很多生产环境也都在使用Nginx服务器。现在做项目大多数时候都是在使用ThinkPHP,但是Nginx默认不支持ThinkPHP的pathinfo模式,需要进行一定的配置。
Nginx配置文件
## The default server#server { listen 80 default_server; #server_name ; #charset koi8-r; #access_log logs/host.access.log main; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; #location / { # root /usr/share/nginx/html; # index index.html index.htm; #} location / { root /var/www/project_name; index index.html index.php; if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; } } error_page 404 /404.html; location = /404.html { root /usr/share/nginx/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$ { root /var/www/project_name; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #}}总结
做个备份,方便以后查看:)
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
概述在上一篇文章Nginx配置Thinkphp支持URLRewrite中已经介绍了如何配置Nginx支持ThinkPHP的URLRewrite,但是上文针对的是
最近项目中涉及到旧老项目迁移,需要在nginx上做些配置,所以简单学习了下,好记性不如烂笔头,先记下来。rewrite首先查看下nginx是否支持rewrite
通常为了友好的URL格式,会进行站点URL的重写,可以在webserver(Nginx)的配置中进行rewrite,也可在在程序端进行以下使用Yaf框架进行UR
最近一个项目中使用了ThinkPHP做为开发框架,URL上我们使用了PATHINFO模式,但是Nginx默认是不支持PATHINFO的,需要进行手动配置才可以,
概述今天遇到一个问题,Ubuntu+Nginx+MySQL配置ThinkPHP的项目,做了一半发现,Nginx不支持ThinkPHP的PATH_INFO模式,百