THINKPHP5 NGINX通用配置
2022/4/6 7:19:49
本文主要是介绍THINKPHP5 NGINX通用配置,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
server {
#配置监听端口
listen 80;
listen [::]:80;
#设置网站根目录作为变量root
set $root /var/www/web;
#设置网站根目录
root $root;
#设置访问日志存放路径
#access_log logs/access.log;
#设置错误日志存放路径
#error_log logs/error.log;
#设置网站默认首页
index index.html index.php;
#设置域名
server_name www.example123.com;
#设置字符集
charset utf-8;
#此配置用于静态文件配置
#location /static {
#try_files $uri $uri/ =404;
#}
#配置PHP的重写规则
location / {
#开启目录浏览功能
#autoindex on;
#关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b
#autoindex_exact_size on;
#开启以服务器本地时区显示文件修改日期
#autoindex_localtime on;
if ( !-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
#配置PHP的pathinfo
location ~ .+\.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}
}
这篇关于THINKPHP5 NGINX通用配置的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-29env: php: no such file or directory
- 2024-03-01php foreach break
- 2024-02-26Exception参数 php-icode9专业技术文章分享
- 2023-12-30PHP文件批量上传-icode9专业技术文章分享
- 2023-12-30thinkphp6 withJoin-icode9专业技术文章分享
- 2023-12-27MagicArray:像php一样,让Go业务代码不再卷!
- 2023-11-18centos7编译安装PHP教程。
- 2023-11-18centos7编译安装phpMyAdmin教程。
- 2023-10-13唱衰这么多年,PHP 仍然还是你大爷!
- 2023-07-25PHP8,性能更好,语法更好,类型安全更完善