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编程最快明白》第七讲:php图片验证码与缩略图
Nov 01 PHP
PHP连接MongoDB示例代码
Sep 06 PHP
hadoop常见错误以及处理方法详解
Jun 19 PHP
浅析PHP页面局部刷新功能的实现小结
Jun 21 PHP
php操作mysqli(示例代码)
Oct 28 PHP
yii框架配置默认controller和action示例
Apr 30 PHP
PHP将字符分解为多个字符串的方法
Nov 22 PHP
php限制文件下载速度的代码
Oct 20 PHP
PHP实现接收二进制流转换成图片的方法
Jan 10 PHP
详谈php ip2long 出现负数的原因及解决方法
Apr 05 PHP
PHP+MySQL实现输入页码跳转到指定页面功能示例
Jun 01 PHP
php压缩文件夹最新版
Jul 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上传文件并存储到mysql数据库的方法
2015/03/16 PHP
yii2超好用的日期组件和时间组件
2016/05/05 PHP
Laravel接收前端ajax传来的数据的实例代码
2017/07/20 PHP
使用JS取得焦点(focus)元素代码
2014/03/22 Javascript
JavaScript实现查找字符串中第一个不重复的字符
2014/12/29 Javascript
jquery简单实现幻灯片的方法
2015/08/03 Javascript
jquery.fastLiveFilter.js实现输入自动过滤的方法
2015/08/11 Javascript
使用bootstrap typeahead插件实现输入框自动补全之问题及解决办法
2016/07/07 Javascript
AngularJS实现DOM元素的显示与隐藏功能
2016/11/22 Javascript
layui 动态设置checbox 选中状态的例子
2019/09/02 Javascript
解决layer.confirm选择完之后消息框不消失的问题
2019/09/16 Javascript
让Vue响应Map或Set的变化操作
2020/11/11 Javascript
详解JavaScript中的this指向问题
2021/02/05 Javascript
[00:47]DOTA2荣耀之路6:天火,天火!
2018/05/30 DOTA
python进阶教程之模块(module)介绍
2014/08/30 Python
Python itertools模块详解
2015/05/09 Python
python获取当前用户的主目录路径方法(推荐)
2017/01/12 Python
深入理解Python对Json的解析
2017/02/14 Python
python爬取拉勾网职位数据的方法
2018/01/24 Python
Python Pandas找到缺失值的位置方法
2018/04/12 Python
Python绘制3D图形
2018/05/03 Python
Python使用itchat模块实现群聊转发,自动回复功能示例
2019/08/26 Python
Python分割训练集和测试集的方法示例
2019/09/19 Python
Django 解决上传文件时,request.FILES为空的问题
2020/05/20 Python
Python OpenCV读取中文路径图像的方法
2020/07/02 Python
耐克美国官网:Nike.com
2016/08/01 全球购物
俄罗斯领先的移动和数字设备在线商店:Svyaznoy.ru
2020/12/21 全球购物
老师推荐信
2013/10/28 职场文书
计算机专业毕业生自我鉴定
2014/01/16 职场文书
优秀语文教师事迹
2014/05/18 职场文书
考试作弊检讨书怎么写?
2014/12/21 职场文书
法定代表人免职证明
2015/06/24 职场文书
vue实现简单数据双向绑定
2021/04/28 Vue.js
手把手教你怎么用Python实现zip文件密码的破解
2021/05/27 Python
Keras多线程机制与flask多线程冲突的解决方案
2021/05/28 Python
Python机器学习应用之基于线性判别模型的分类篇详解
2022/01/18 Python