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 相关文章推荐
投票管理程序
Oct 09 PHP
Php注入点构造代码
Jun 14 PHP
php入门教程 精简版
Dec 13 PHP
php预定义变量使用帮助(带实例)
Oct 30 PHP
php socket客户端及服务器端应用实例
Jul 04 PHP
PHP制作用户注册系统
Oct 23 PHP
mac系统下为 php 添加 pcntl 扩展
Aug 28 PHP
laravel5.2实现区分前后台用户登录的方法
Jan 11 PHP
PHP实现求两个字符串最长公共子串的方法示例
Nov 17 PHP
PHP+MySQL实现消息队列的方法分析
May 09 PHP
解决PHP使用CURL发送GET请求时传递参数的问题
Oct 11 PHP
确保Laravel网站不会被嵌入到其他站点中的方法
Oct 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中函数前加&符号的作用分解
2014/07/08 PHP
php文件缓存类汇总
2014/11/21 PHP
AJAX的使用方法详解
2017/04/29 PHP
关于IE浏览器以及Firefox下的javascript冒泡事件的响应层级
2010/10/14 Javascript
用JQuery实现表格隔行变色和突出显示当前行的代码
2012/02/10 Javascript
jquery mobile的触控点击事件会多次触发问题的解决方法
2014/05/08 Javascript
href下载文件根据id取url并下载
2014/05/28 Javascript
使用JS画图之点、线、面
2015/01/12 Javascript
JS给超链接加确认对话框的方法
2015/02/24 Javascript
详解jQuery中关于Ajax的几个常用的函数
2017/07/17 jQuery
JS+WCF实现进度条实时监测数据加载量的方法详解
2017/12/19 Javascript
15 分钟掌握vue-next响应式原理
2019/10/13 Javascript
JavaScript计算正方形面积
2019/11/26 Javascript
Vue3不支持Filters过滤器的问题
2020/09/24 Javascript
Python实现抓取网页并且解析的实例
2014/09/20 Python
Python使用django框架实现多人在线匿名聊天的小程序
2017/11/29 Python
使用sklearn之LabelEncoder将Label标准化的方法
2018/07/11 Python
Python中使用logging和traceback模块记录日志和跟踪异常
2019/04/09 Python
使用Python制作新型冠状病毒实时疫情图
2020/01/28 Python
解决pyecharts运行后产生的html文件用浏览器打开空白
2020/03/11 Python
python学习笔记之多进程
2020/08/06 Python
利用python为PostgreSQL的表自动添加分区
2021/01/18 Python
html table呈现个人简历以及单元格宽度失效的问题解决
2021/01/22 HTML / CSS
佛罗里达州印第安河新鲜水果:Hale Groves
2017/02/20 全球购物
美国瑜伽品牌:Gaiam
2017/10/31 全球购物
西班牙土拨鼠床垫公司,感觉在云端:Marmota
2019/03/18 全球购物
如何在C# winform中异步调用web services
2015/09/21 面试题
见习期自我鉴定
2013/11/07 职场文书
关于感恩的演讲稿800字
2014/08/26 职场文书
2015年效能监察工作总结
2015/04/23 职场文书
丧事主持词
2015/07/02 职场文书
2016年重阳节慰问信
2015/12/01 职场文书
nginx对http请求处理的各个阶段详析
2021/03/31 Servers
Python实现生活常识解答机器人
2021/06/28 Python
python多线程方法详解
2022/01/18 Python
win10忘记pin密码登录不了怎么办?win10忘记pin密码登不进去的解决方法
2022/07/07 数码科技