本人菜鸟刚接触thinkcmf 刚学习搭建环境 但通过官方手册上nginx的配置后 一直访问不了从500-404-403
也因为时间关系 用lnmp一键安装包安装 没有源码编译lnmp 可能导致了现在的问题 不多说了 我直接贴配置
我不太清楚是phpinfo还是rewrite的问题 网上搜集了很多配置尝试修改 最下面注释的是根据官方的配置然后修改,没注释的是现在404的 有大神可以提点下表示非常感谢。
环境版本 PHP 5.6.31
nginx/1.12.1
mysql Ver 14.14 Distrib 5.6.36
server {
listen 80;
#listen [::]:80 default_server;
server_name _;
root /home/www/default/thinkcmf/public;
index index.html index.htm index.php api.php;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
#tp rewrite模式
#location / {
#if (!-e $request_filename) {
#rewrite ^(.*)$ /index.php?s=$1 last;
#break;
#}
#}
location ~ \.php$ {
#root /home/www/default/thinkcmf/public;
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
#tp pathinfo模式
location ~ \.php {
root /home/www/default/thinkcmf/public;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
#server
# {
# listen 80 default_server;
# #listen [::]:80 default_server ipv6only=on;
# server_name 192.168.100.123;
# #index index.html index.htm index.php;
# root /home/wwwroot/default/thinkcmf/public;
#
# #error_page 404 /404.html;
#
# # Deny access to PHP files in specific directory
# #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
#
# include enable-php.conf;
#
#location / {
# root /home/wwwroot/default/thinkcmf/public;
#index index.php index.html index.htm;
# #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
# if (!-e $request_filename)
# {
# #地址作为将参数rewrite到index.php上。
# rewrite ^/PHPParser/(.*)$ /PHPParser/index.php?s=$1 last;
# #若是子目录则使用下面这句,将subdir改成目录名称即可。
# #rewrite ^/subdir/(.*)$ /subdir/index.php?s=$1;
# break;
# }
# }
#location /api/ {
# index index.php index.html index.htm;
# #如果请求既不是一个文件,也不是一个目录,则执行一下重写规则
# if (!-e $request_filename)
# {
# #地址作为将参数rewrite到index.php上。
# #rewrite ^/(.*)$ /index.php?s=$1;
# #若是子目录则使用下面这句,将subdir改成目录名称即可。
# rewrite ^/api/(.*)$ /api/index.php?s=$1;
# }
# }
#
#location ~* \/upload\/.+\.(html|php)$ {
#return 404;
#}
#
#location ~* ^\/plugins\/.+\.(html|php)$ {
#return 404;
#}
#
#location ~* \/themes\/.+\.(html|php)$ {
#return 404;
#}
#
#
##proxy the php scripts to php-fpm
#
# location ~ \.php {
# root /home/wwwroot/default/thinkcmf/public;
# include fastcgi_params;
# ##pathinfo支持start
# #定义变量 $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_split_path_info ^(.+\.php)(.*)$;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
# fastcgi_param SCRIPT_NAME $real_script_name;
# fastcgi_param PATH_INFO $path_info;
# ###pathinfo支持end
# fastcgi_intercept_errors on;
# fastcgi_pass 127.0.0.1:9000;
# }
#
#}
#location /nginx_status
#{
# stub_status on;
# access_log off;
#}
#location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
#{
# expires 30d;
#}
#location ~ .*\.(js|css)?$
#{
# expires 12h;
#}
#location ~ /.well-known {
# allow all;
#}
#location ~ /\.
#{
# deny all;
#}
access_log /home/wwwlogs/access.log;
#}
#include vhost/*.conf;
}
0.话题发布后没及时显示,请联系官方QQ群管理;
1.话题支持代码,qq截屏直接粘贴,和QQ群一样;
2.问题描述清,比如服务器版本,程序版本;
3.能上代码,就不用文字;
4.把问题发到话题后再发QQ群;
5.如果感觉回复者解答的不错,可以发红包!
6.多帮助别人也是对自己的锻炼!
7.付费讨论中只有提问者和付费用户才可以查看回复
1.评论积分+1;每天最多10次奖励
2.发布话题积分+1;每天最多5次奖励
3.垃圾评论积分-500;
4.黄色,暴力,违反我国法律评论直接封号