ThinkPHP 在阿里云上的nginx.config配置实例详解


Posted in PHP onOctober 11, 2017

具体代码如下所示:

# For more information on configuration, see:
#  * Official English Documentation: http://nginx.org/en/docs/
#  * Official Russian Documentation: http://nginx.org/ru/docs/
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
events {
  worker_connections 1024;
}
http {
  log_format main '$remote_addr - $remote_user [$time_local] "$request" '
           '$status $body_bytes_sent "$http_referer" '
           '"$http_user_agent" "$http_x_forwarded_for"';
  access_log /var/log/nginx/access.log main;
  sendfile      on;
  tcp_nopush     on;
  tcp_nodelay     on;
  keepalive_timeout  65;
  types_hash_max_size 2048;
  include       /etc/nginx/mime.types;
  default_type    application/octet-stream;
  # Load modular configuration files from the /etc/nginx/conf.d directory.
  # See http://nginx.org/en/docs/ngx_core_module.html#include
  # for more information.
  include /etc/nginx/conf.d/*.conf;
  server {
    listen    80 default_server;
    listen    [::]:80 default_server;
    server_name _;
    root     /usr/share/nginx/html;
    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;
    location / {
       #try_files $uri $uri/ /index.php;
       root  /usr/share/nginx/html;
       index index.php index.html index.htm;
       if (!-e $request_filename) {  rewrite ^(.*)$ /index.php?s=$1 last;  break;  }
    }      
    # redirect server error pages to the static page /40x.html
    #
    error_page 404       /404.html;     
    location = /40x.html {
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page  500 502 503 504 /50x.html; 
    location = /50x.html {
    }
    location ~ \.php$ {
    root      /usr/share/nginx/html;
    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include    fastcgi_params;
    }
    location ~ /\.ht {
    deny all;
    }
  }
}

总结

以上所述是小编给大家介绍的ThinkPHP 在阿里云上的nginx.config配置实例详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对三水点靠木网站的支持!

PHP 相关文章推荐
攻克CakePHP系列一 连接MySQL数据库
Oct 22 PHP
php session 检测和注销
Mar 16 PHP
php pack与unpack 摸板字符字符含义
Oct 29 PHP
discuz程序的PHP加密函数原理分析
Aug 05 PHP
PHP5权威编程阅读学习笔记 附电子书下载
Jul 05 PHP
解析Ubuntu下crontab命令的用法
Jun 24 PHP
基于PHP的简单采集数据入库程序【续篇】
Jul 30 PHP
jQuery+PHP发布的内容进行无刷新分页(Fckeditor)
Oct 22 PHP
PHP中对数组的一些常用的增、删、插操作函数总结
Nov 27 PHP
Zend Framework分页类用法详解
Mar 22 PHP
php将print_r处理后的数据还原为原始数组的解决方法
Nov 02 PHP
利用php-cli和任务计划实现刷新token功能的方法
May 03 PHP
Laravel中的Blade模板引擎示例详解
Oct 10 #PHP
PHP小白必须要知道的php基础知识(超实用)
Oct 10 #PHP
PHP实现数据库统计时间戳按天分组输出数据的方法
Oct 10 #PHP
PHP使用Redis实现防止大并发下二次写入的方法
Oct 09 #PHP
PHP字典树(Trie树)定义与实现方法示例
Oct 09 #PHP
PHP完全二叉树定义与实现方法示例
Oct 09 #PHP
PHP实现的折半查询算法示例
Oct 09 #PHP
You might like
杏林同学录(八)
2006/10/09 PHP
PHP的5个安全措施小结
2012/07/17 PHP
php之CodeIgniter学习笔记
2013/06/17 PHP
用JavaScript显示随机图像或引用
2009/04/21 Javascript
js滚动条回到顶部的代码
2011/12/06 Javascript
纯js网页画板(Graphics)类简介及实现代码
2012/12/24 Javascript
JQuery入门——事件切换之hover()方法应用介绍
2013/02/05 Javascript
JS 实现列表与多选框选择附预览动画
2014/10/29 Javascript
jQuery仿Flash上下翻动的中英文导航菜单实例
2015/03/10 Javascript
jQuery height()、innerHeight()、outerHeight()函数的区别详解
2016/05/23 Javascript
浅谈Angular2 模块懒加载的方法
2017/10/04 Javascript
jsonp跨域及实现百度首页联想功能的方法
2018/08/30 Javascript
CentOS7中源码编译安装NodeJS的完整步骤
2018/10/13 NodeJs
Vue根据条件添加click事件的方式
2019/11/09 Javascript
浅谈vue中组件绑定事件时是否加.native
2019/11/09 Javascript
Node.js API详解之 readline模块用法详解
2020/05/22 Javascript
Python模拟登陆实现代码
2017/06/14 Python
解决nohup执行python程序log文件写入不及时的问题
2019/01/14 Python
在django中form的label和verbose name的区别说明
2020/05/20 Python
五种Python转义表示法
2020/11/27 Python
总结30个CSS3选择器
2017/04/13 HTML / CSS
移动web模拟客户端实现多方框输入密码效果【附代码】
2016/03/25 HTML / CSS
中学生团员自我评价分享
2013/12/07 职场文书
求职信写作要突出重点
2014/01/01 职场文书
本科生职业生涯规划书范文
2014/01/21 职场文书
《晏子使楚》教学反思
2014/02/08 职场文书
巾帼建功标兵事迹材料
2014/05/11 职场文书
展览会邀请函
2015/02/02 职场文书
商超业务员岗位职责
2015/02/13 职场文书
语文教师求职信范文
2015/03/20 职场文书
如何做好员工培训计划?
2019/07/09 职场文书
2019个人年度目标制定攻略!
2019/07/12 职场文书
大学生如何逃脱“毕业季创业队即散伙”魔咒?
2019/08/19 职场文书
python开发飞机大战游戏
2021/07/15 Python
Win11 Build 21996.1 Dev版怎么样? win11系统截图欣赏
2021/11/21 数码科技
详细介绍Java中的CyclicBarrier
2022/04/13 Java/Android