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 相关文章推荐
php md5下16位和32位的实现代码
Apr 09 PHP
php 分页类 扩展代码
Jun 11 PHP
php 取得瑞年与平年的天数的代码
Aug 10 PHP
php cli模式学习(PHP命令行模式)
Jun 03 PHP
PHP循环函数使用介绍之PHP基础入门教程
Sep 21 PHP
php inc文件使用的风险和注意事项
Nov 12 PHP
PHP中strtr字符串替换用法详解
Nov 26 PHP
windows下apache搭建php开发环境
Aug 27 PHP
实现PHP框架系列文章(6)mysql数据库方法
Mar 04 PHP
PHP实现的简单适配器模式示例
Jun 22 PHP
Thinkphp5+plupload实现的图片上传功能示例【支持实时预览】
May 08 PHP
Laravel jwt 多表(多用户端)验证隔离的实现
Dec 18 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
php给每个段落添加空格的方法
2015/03/20 PHP
php json转换相关知识(小结)
2018/12/21 PHP
yii2 开发api接口时优雅的处理全局异常的方法
2019/05/14 PHP
Javascript中的数学函数集合
2007/05/08 Javascript
超精准的javascript验证身份证号的具体实现方法
2015/11/18 Javascript
jQuery实现ajax调用WCF服务的方法(附带demo下载)
2015/12/04 Javascript
BootStrap的alert提示框的关闭后再显示怎么解决
2016/05/17 Javascript
jquery实现简单实用的轮播器
2017/05/23 jQuery
提高Node.js性能的应用技巧分享
2017/08/10 Javascript
基于cropper.js封装vue实现在线图片裁剪组件功能
2018/03/01 Javascript
element-ui 上传图片后清空图片显示的实例
2018/09/04 Javascript
javascript动态创建对象的属性详解
2018/11/07 Javascript
JS数组方法shift()、unshift()用法实例分析
2020/01/18 Javascript
vue实现一个获取按键展示快捷键效果的Input组件
2021/01/13 Vue.js
[01:01:24]DOTA2上海特级锦标赛A组败者赛 EHOME VS CDEC第三局
2016/02/25 DOTA
[30:51]DOTA2上海特级锦标赛主赛事日 - 3 胜者组第二轮#1Liquid VS MVP.Phx第一局
2016/03/04 DOTA
详细解读Python中解析XML数据的方法
2015/10/15 Python
Python中防止sql注入的方法详解
2017/02/25 Python
PythonWeb项目Django部署在Ubuntu18.04腾讯云主机上
2019/04/01 Python
python pytest进阶之xunit fixture详解
2019/06/27 Python
python GUI库图形界面开发之PyQt5滑块条控件QSlider详细使用方法与实例
2020/02/28 Python
python解析xml文件方式(解析、更新、写入)
2020/03/05 Python
CSS3实现千变万化的文字阴影text-shadow效果设计
2016/04/26 HTML / CSS
HTML5中如何显示视频呢 HTML5视频播放demo
2013/06/08 HTML / CSS
MediaMarkt比利时:欧洲最大电器连锁店
2020/12/21 全球购物
如何将字串String转换成整数int
2015/02/21 面试题
中文系师范生自荐信
2013/10/01 职场文书
自考毕业生自我鉴定
2013/11/04 职场文书
图书室管理制度
2014/01/19 职场文书
欢送退休感言
2014/02/08 职场文书
开展党的群众路线教育实践活动工作总结
2014/11/05 职场文书
2015年医院科室工作总结范文
2015/05/26 职场文书
新学期开学寄语2016
2015/12/04 职场文书
css position fixed 左右双定位的实现代码
2021/04/29 HTML / CSS
解决mysql问题:由于找不到MSVCR120.dll,无法继续执行代码
2021/06/26 MySQL
「我的青春恋爱物语果然有问题。-妄言录-」第20卷封面公开
2022/03/21 日漫