nginx php permanent,ubunt mint配置nginx处理thinkphp框架

把dir替换为自己的项目路径

把fastcgi_pass unix替换为Unix监听php的socket文件路径即可

不想使用Unix方式处理php换为监听php的端口号即可

server

{

listen 80;

server_name lochvip.bairuishequ.com;

root dir;

indexindex.php

access_log /var/log/nginx/menglin1042_access.log;

error_log /var/log/nginx/menglin1042_error.log;

location / {

if (!-e $request_filename) {

rewrite ^(.*)$ /index.php?s=/$1 last;

break;

}

#auth_basic "登录认证";

#auth_basic_user_file /etc/nginx/pass_file;

#allow 127.0.0.1;

#deny all;

}

#location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {

#expires 30d;

#error_log off;

#access_log /dev/null;

#}

#location ~ .*\.(js|css)?$ {

#expires 12h;

#error_log off;

#access_log /dev/null;

#}

location ~ htyml{

rewrite ^(.*)$ /uPHzGEcadU.php permanent;

}

error_page 500 502 503 504 /50x.html;

error_page 404 /404.html;

location = /50x.html {

root /var/www/nginx;

}

location = /404.html {

root /var/www/nginx;

}

location ~ \.php(.*)$ {

#fastcgi_pass 127.0.0.1:9000;

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

fastcgi_index index.php;

#为了支持pathinfo 增加如下设置

#下面两句是给fastcgi权限,可以支持 ?s=/module/controller/action的url访问$

fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

#下面两句才能真正支持 index.php/index/index/index的pathinfo模式

fastcgi_param PATH_INFO $fastcgi_path_info;

fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;

fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root/:/tmp/:/proc/:dir";

include fastcgi_params;

}

client_max_body_size 50M;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值