PHP:ThinkPHP5.0配置nginx
2023-09-14 09:07:19 时间
尝试了好多次,总算找到可以用的配置文件了,记录下
server {
listen 80;
server_name thinkphp.lo;
root /var/www;
index index.html index.htm index.php;
error_page 404 /404.html;
location = /404.html {
return 404 'Sorry, File not Found!';
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html; # windows用户替换这个目录
}
location / {
try_files $uri @rewrite;
}
location @rewrite {
set $static 0;
if ($uri ~ \.(css|js|jpg|jpeg|png|gif|ico|woff|eot|svg|css\.map|min\.map)$) {
set $static 1;
}
if ($static = 0) {
rewrite ^/(.*)$ /index.php?s=/$1;
}
}
location ~ /Uploads/.*\.php$ {
deny all;
}
location ~ \.php/ {
if ($request_uri ~ ^(.+\.php)(/.+?)($|\?)) { }
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_NAME $1;
fastcgi_param PATH_INFO $2;
fastcgi_param SCRIPT_FILENAME $document_root$1;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
相关文章
- macOS 通过brew配置php,nginx,composer,php-zip,php-redis
- [PHP] apache在worker模式配置fastcgi使用php-fpm详解编程语言
- Linux快速部署配置PHP服务器环境(linux部署php环境)
- 卸载php程序详解编程语言
- 快速拥抱Web开发:PHP与MySQL(php和mysqlweb开发)
- PHP搭建Redis环境指南(php配置redis)
- 解锁PHP的高效Oracle配置(php配置oracle)
- Nginx高性能Web服务器:Nginx与PHP(FastCGI)的安装、配置与优化(第四章)
- Nginx网站架构实战——09、编译PHP并与nginx整合
- 教你如何用PHP获取MySQL数据库中的数据(php获取mysql数据)
- 那么流行PHP和MySQL——广泛应用的利器(为什么php和mysql)
- Linux系统下快速配置安装PHP环境(linux 安装php)
- PHP链接MSSQL:解开空白之谜(php链接mssql空白)
- PHP与MSSQL融合产生的丰盛果实(php和mssql环境)
- 使用PHP连接MSSQL数据库的查询语句(php mssql 语句)
- Linux平台如何高效搜索PHP文件(linux搜索php)
- 用PHP给MySQL数据库做个彻底的备份(php备份mysql数据库)
- Linux下搭建PHP开发环境的一步步操作(linux配置php环境)
- 基于Oracle和PHP的新一代组件全面上线(oracle php组件)
- 无法在发生错误时创建会话,请检查PHP或网站服务器日志,并正确配置PHP安装最快的解决办法
- php类声明和php类使用方法示例分享
- PHP+FastCGI+Nginx配置PHP运行环境