LNMP下thinkPHP配置记录

栏目: PHP · 发布时间: 8年前

内容简介:LNMP下thinkPHP配置记录

这段时间一直在学习小程序相关知识,想借助微信平台,在小程序上开发一套商城,初期想实现的基本功能是,能够单独购买,团购,下单可以修改数量,物品有基本的库存,销量,有规格可设置不同价格.

thinkPHP是国内比较流行的 PHP 框架,特别是5.0之后的版本,做了很多优化,删减,更加简洁,为API开发而设计的高性能框架,受到很多PHP开发者的青睐.

用thinkPHP开发完项目,下一步就是要部署,小O的生产环境是在 Linux 下,使用Nginx作为http和反向代理服务器.小O安装的是lnmp,thinPHP5.0.7,nginx1.10.0的环境遇到的情况

1.找不到文件Warning:scandisk()问题,解决办法打开vim /usr/local/PHP/etc/PHP.ini,找到disable_functions去掉scandir保存(:wq)并重启PHP-fpm即可.

2.PHP fastcgi配置,在vim /usr/local/nginx/conf/enable-PHP-tp5.conf,配置内容:

location ~ [^/].php(/|$) { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #定义变量 $path_info 用于存放pathinfo信息 set $path_info “”; #定义变量 $real_script_name用于存放真实地址 set $real_script_name $fastcgi_script_name; #如果地址与引号内的正则表达式匹配 if ($fastcgi_script_name ~ “^(.+?.php)(/.+)$”) { #将文件地址赋值给变量 $real_script_name set $real_script_name $1; #将文件地址后的参数赋值给变量 $path_info set $path_info $2; } #配置fastcgi的一些参数 fastcgi_param SCRIPT_FILENAME $document_root$real_script_name; fastcgi_param SCRIPT_NAME $real_script_name; fastcgi_param PATH_INFO $path_info; }

3.配置HTTPS,vim /use/local/nginx/conf/vhost/tpsc.domain.com.ssl.conf,需要获取SSL的证书,可以从各大云平台免费获取即可

server { listen 443; server_name tpsc.domain.com; index index.php access_log /data/wwwlogs/tpsc_domain_access.log; error_log /data/wwwlogs/tpsc_domain_error.log; set $root /data/xcx/tp5/public; root /data/xcx/tp5/public; ssl on; ssl_certificate vhost/ssl/tpsc_domain.pem; ssl_certificate_key vhost/ssl/tpsc_domain_private.key; ssl_session_timeout 5m; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL; ssl_prefer_server_ciphers on; #error_page 404 /404.html; include enable-php-tp5.conf; location /nginx_status { stub_status on; access_log off; } location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*.(js|css)?$ { expires 12h; } location ~ /. { deny all; } }

4.配置80端口跳转到443,vim /use/local/nginx/conf/vhost/tpsc.domain.com.conf

server { listen 80; server_name tpsc.domain.com; rewrite ^(.*) https://$server_name$1 permanent; }

简单的配置希望对您有帮助.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Automate This

Automate This

Christopher Steiner / Portfolio / 2013-8-9 / USD 25.95

"The rousing story of the last gasp of human agency and how today's best and brightest minds are endeavoring to put an end to it." It used to be that to diagnose an illness, interpret legal docume......一起来看看 《Automate This》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

URL 编码/解码
URL 编码/解码

URL 编码/解码