nginx,php,tp框架版本:

nginx版本:
[root@z_centos nginx]# /usr/local/nginx/sbin/nginx -h
nginx version: nginx/1.13.9 tp5版本:
thinkphp 5.0.18 PHP版本:
[root@z_centos nginx]# php -v
PHP 7.2.3 (cli) (built: Mar 8 2018 14:43:32) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3, Copyright (c) 1999-2018, by Zend Technologies

usr/locol/nginx/conf/vhost/www.xxxx.com.conf 配置文件
主配置文件中使用 include ./vhost/*.conf; 引入即可

https 443端口配置项:

server {
listen 443 ssl;
server_name www.xxxx.com;
set $root /usr/local/nginx/webroot/tp5/public;
ssl_certificate /etc/letsencrypt/live/www.xxxx.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/www.xxxx.com/privkey.pem;
ssl_session_timeout 5m;
ssl_prefer_server_ciphers on;
access_log logs/www.myzb.pw.access.log main;
    
     if ($http_user_agent ~* "qihoobot|Baiduspider|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot")
  {
   return 403;
  } location ~ ..(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
location / {
root $root;
index index.php index.html index.htm;
if ( -f $request_filename) {
break;
} if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
} fastcgi_pass unix:/var/run/www/php-cgi.sock;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params; } location ~ /\.(ht|svn|git) {
deny all;
}
}
http 80端口配置项:
server {
listen 80;
server_name tp510.manzb.top;
set $root /usr/local/nginx/www/tp510/public;
access_log logs/tp510.manzb.top.access.log main;
location ~ ..(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
location / {
root $root;
index index.php index.html index.htm;
if ( -f $request_filename) {
break;
} if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
} error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ .+\.php($|/) {
set $script $uri;
set $path_info "";
if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
} fastcgi_pass unix:/var/run/www/php-cgi.sock;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params; } location ~ /\.(ht|svn|git) {
deny all;
}
}

其中:fastcgi_pass之所以使用unix:/var/run/www/php-cgi.sock;配置参数,是因为:http://www.cnblogs.com/manzb/p/8875406.html

重启nginx时若出现了如下错误:

nginx: [emerg] unknown log format "proxy_log" in /usr/local/macports/etc/nginx/nginx.conf:147

解决办法:

打开nginx.conf,"main"错误是因为丢失了log_format选项,之前把他屏蔽掉了,修改之后问题解决。

http {
    include       mime.types;
    default_type  application/octet-stream;     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

nginx配置thinkphp5的更多相关文章

  1. centos6.8 环境一键安装包 nginx配置thinkphp5

    ---恢复内容开始--- lnmp1.4 一键安装包 nginx配置thinkphp5     环境:Nginx1.12.1  PHP5.6  Coentos6.8 修改网站配置文件      ser ...

  2. nginx配置ThinkPHP5二级目录访问

    可以通过 http://www.mracale.com/项目名/模块名/方法名 进行访问 第一步 首先,你要确保在不配置二级目录的情况下,可以通过浏览器访问到.例如:http://www.mracal ...

  3. lnmp1.4 nginx配置thinkphp5

    vhost/xxx.conf配置图,重点是红色框框 研究了两三天 ,至此thinkphp5 路由,隐藏index.php全部解决 感谢网友的分享:http://blog.csdn.net/gaoxiu ...

  4. nginx配置反向代理或跳转出现400问题处理记录

    午休完上班后,同事说测试站点访问接口出现400 Bad Request  Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...

  5. Windos环境用Nginx配置反向代理和负载均衡

    Windos环境用Nginx配置反向代理和负载均衡 引言:在前后端分离架构下,难免会遇到跨域问题.目前的解决方案大致有JSONP,反向代理,CORS这三种方式.JSONP兼容性良好,最大的缺点是只支持 ...

  6. Windows下Nginx配置SSL实现Https访问(包含证书生成)

    Vincent.李   Windows下Nginx配置SSL实现Https访问(包含证书生成) Windows下Nginx配置SSL实现Https访问(包含证书生成) 首先要说明为什么要实现https ...

  7. Nginx 配置简述

    不论是本地开发,还是远程到 Server 开发,还是给提供 demo 给人看效果,我们时常需要对 Nginx 做配置,Nginx 的配置项相当多,如果考虑性能配置起来会比较麻烦.不过,我们往往只是需要 ...

  8. Nginx配置详解

    序言 Nginx是lgor Sysoev为俄罗斯访问量第二的rambler.ru站点设计开发的.从2004年发布至今,凭借开源的力量,已经接近成熟与完善. Nginx功能丰富,可作为HTTP服务器,也 ...

  9. Nginx配置Https

    1.申请证书: https://console.qcloud.com/ssl?utm_source=yingyongbao&utm_medium=ssl&utm_campaign=qc ...

随机推荐

  1. 【Beta阶段】第三次Scrum Meeting!

    每日任务内容: 本次会议为第三次Scrum Meeting会议~ 由于本次会议项目经理召开时间依旧较晚(晚上12点半),所以在公寓7层召开,女生参与了线上会议,召开时间大家集会10分钟. 队员 昨日完 ...

  2. 20135327郭皓--Linux内核分析第五周 扒开系统调用的三层皮(下)

    Linux内核分析第五周 扒开系统调用的三层皮(下) 郭皓 原创作品转载请注明出处 <Linux内核分析>MOOC课程 http://mooc.study.163.com/course/U ...

  3. vue如何触发某个元素的单击事件?

    <a class="link" @click.native="test">1111</a> <a class="link ...

  4. python项目离线环境配置指南

    参考文献: http://blog.csdn.net/candcplusplus/article/details/52156324 https://www.cnblogs.com/michael-xi ...

  5. final版本发布评价II

    其实我对技术上的问题了解不多,所以有些评语可能说的不对或者压根就没啥用.可直接忽略.请见谅. 1新蜂的俄罗斯方块,UI设计虽然给出了背景和颜色,但是感觉色彩对比也不好,模块之间也不协调.没有更多的说服 ...

  6. SQLSERVER 设置自动备份数据库

    1. SQLSERVER 简单的设置 计划任务 进行 备份数据库的操作. 首先需要打开 一些设置 执行 命令如下: sp_configure ; GO RECONFIGURE; GO sp_confi ...

  7. emoji & click copy

    emoji & click copy document.execCommand("copy"); https://clipboardjs.com/ https://www. ...

  8. Bootstrap-table学习笔记

    | 引入CSS文件 <link rel="stylesheet" href="bootstrap.min.css"> <link rel=&q ...

  9. poj1741 Tree(点分治)

    题目链接:http://poj.org/problem?id=1741 题意:求树上两点之间距离小于等于k的点对的数量 思路:点分治模板题,推荐一篇讲的非常好的博客:https://blog.csdn ...

  10. gym101350 c h m

    C. Cheap Kangaroo time limit per test 1.0 s memory limit per test 256 MB input standard input output ...