nginx 1.14.0 配置部署 thinkphp 5.1
开始接触NGINX,配置tp5配了半天,找不到具体原因,于是用网上搜索到的配置复制粘贴搞定。
感谢 https://blog.csdn.net/qq_36431213/article/details/80456993
开始以为是rewrite部分写不正确,其实根本就不用if(!-e $request_name){ rewrite ^(.*)$ /index.php/$ last;break;},
用 try_files $uri $uri/ index.php?$request_string;就可以,傻傻折腾了半天,要不得!!!
详看附件
- 下面开始上配置
server {
listen 80; #端口
server_name localhost; #主机名
set $root /usr/share/nginx/html/tp5/public/; #文件入口
index index.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#静态资源
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root /usr/share/nginx/html;
}
location ~ \.css {
add_header Content-Type text/css;
}
location ~ \.js {
add_header Content-Type application/x-javascript;
}
#php请求
location / {
include /etc/nginx/mime.types
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
root $root;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $request_uri;
include fastcgi_params;
}
#
location ~ /\.ht {
deny all;
}
}
或者
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
root /usr/share/nginx/html/tp5/public/;
index index.php;
}
#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$ {
root /usr/share/nginx/html/tp5/public/;
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;
#}
}
nginx 1.14.0 配置部署 thinkphp 5.1的更多相关文章
- centos 7.2 下 nginx 1.14.1 安装部署
Nginx1.14.1安装部署 1.环境: 所有源码在跳板机kx的/web/soft下 2.安装依赖: [root@bogon src]# yum install -y libxml2 openssl ...
- CentOS 7.4安装Nginx 1.14.0
一.安装所需环境 1.gcc 安装 yum install gcc-c++
- nginx HTTP/2.0 配置
1.前言 最近无意中看到http2.0消息,发现自己的博客虽然配了https,但并没有配置http2.0,所以搞了个玩玩,本以为配个参数就搞定了,结果还是折腾了一个小时. 2.过程 nginx并没有默 ...
- Centos 7 编译nginx 1.14.0
步骤一:下载nginx安装包 wget https://nginx.org/download/nginx-1.14.0.tar.gz 步骤二:安装nginx依赖包 yum install -y gcc ...
- kubenetes_V1.14.0 安装部署
k8s的安装有多种方式,如yum安装,kubeadm安装,kubemini安装,二进制安装(生产环境多采用此方式精确控制安装)等.本文是入门系列验证,之前进行过yum安装,可以查看文章<k8s入 ...
- Centos7 编译安装 Nginx Mariadb Asp.net Core2 (实测 笔记 Centos 7.3 + Openssl 1.1.0h + Mariadb 10.3.7 + Nginx 1.14.0 + Asp.net. Core 2 )
环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7-x86_64-Minimal-1611.iso 安装步骤: 1.准备 1.0 查看硬 ...
- Nginx HA 及https配置部署
Nginx HA 整体方案架构为: (内网192.168.199.5) +-----------VIP----------+ | | | | Master Backup 192.168.199.90 ...
- Nginx安装负载均衡配置 fair check扩展
前言 本文主要是针对Nginx安装.负载均衡配置,以及fair智能选举.check后端节点检查扩展功能如何扩展,进行讲解说明. fair模块: upstream-fair,“公平的”Nginx 负载均 ...
- Ubuntu 16.04 安装最新稳定版Nginx 1.6.0
Ubuntu 16.04 默认安装的是nginx 1.14.0 #默认安装方式:apt-get install nginx 1.查看是否安装nginx,如果已经安装,请先卸载 #查看安装版本 d ...
随机推荐
- asp.net Checkbox 绑定自定义属性
var chkSelect = e.Row.FindControl("chkSelect") as CheckBox; chkSelect.InputAttributes.Add( ...
- Spring的依赖注入的2种方式(1天时间)
今天花了一天的时间才调试出来 private 接口 实现类的那个bean; 最后面的那个名字不能随便的写,必须是配置文件中,实现类的那个bean 就是后面的那个名字写错了,花了整整一天 ...
- Stream Processing 101: From SQL to Streaming SQL in 10 Minutes
转自:https://wso2.com/library/articles/2018/02/stream-processing-101-from-sql-to-streaming-sql-in-ten- ...
- 关于导出csv格式文件的身份证号、日期的处理
EXCEL系统的单元格,默认格式是常规或数值格式下,数字超过10位即以科学计数法显示,对15位以后的数字用0填充. 在导入到Excel.导出csv文件时,对于身份证号自动变成科学计数法的地方,就要做一 ...
- ML(5)——神经网络2(BP反向传播)
上一章的神经网络实际上是前馈神经网络(feedforward neural network),也叫多层感知机(multilayer perceptron,MLP).具体来说,每层神经元与下一层神经元全 ...
- 預約申領往來港澳通行證及簽注x
http://www.ctshk.com/passport/talent_bookrep.htm 換領往來港澳通行證和申請簽注延期須知 為方便持<往來港澳通行證>以內地逗留簽注在香港工作. ...
- oracle 之 CLUSTER_INTERCONNECTS is not set to the recommended value
问题:Database parameter CLUSTER_INTERCONNECTS is not set to the recommended value 在Oracle实际应用程序集群环境中可以 ...
- Docker容器里的进程为什么要前台运行?相同的问题:docker运行apache为什么带FOREGROUND参数?docker运行nginx为什么带`daemon off`参数?
<第一本Docker书>里面,讲到Docker容器启动web服务时,都指定了前台运行的参数. 例如apache: ENTRYPOINT [ "/usr/sbin/apache2& ...
- Maven项目main和test文件夹说明
需要自己来手动调整项目目录, Maven项目通常划分为 main 和 test 两部分,main 中存放实际项目资源,test 存放测试项目资源,二者内部同时又划分为 source 和 resourc ...
- 解决The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one time zone
Spring Boot JPA 使用Mysql是出现如下错误: The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represe ...