[nginx]nginx的一个奇葩问题 500 Internal Server Error phpstudy2018 nginx虚拟主机配置 fastadmin常见问题处理
[nginx]nginx的一个奇葩问题 500 Internal Server Error
解决方案
nginx 一直报500 Internal Server Error 错误,配置是通过phpstudy2018站点域名管理生成的。
默认是 root "D:\php\phpstudy\PHPTutorial\WWW\foxphp";
修改成这样就好了
root "D:\\php\\phpstudy\\PHPTutorial\\WWW\\foxphp";
查找了很多资料,因为很奇葩,木有多少可供参考的,之前配置单斜杠一直木有问题,也找不到为毛产生的。有人说是地址问题,或许是单斜杠被当成转义符号了吧,那就再加一个,然后就没有然后了,php网站可以通过域名正常访问了。
好吧,nginx我确实没有系统的从头到尾学习,一般能有就好。个人愚见,遇见了奇葩问题就记录了下来进行分享,或许能够给别人带来帮助。
server {
listen ;
server_name k.cn ;
root "D:\\php\\phpstudy\PHPTutorial\\WWW\\kppw";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server {
listen ;
server_name t.cn ;
root "D:\\php\\phpstudy\PHPTutorial\\WWW\\thinkphp\\public";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server {
listen ;
server_name o.cn ;
root "D:\\php\\phpstudy\PHPTutorial\\WWW\\opensns";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server {
listen ;
server_name f.cn ;
root "D:\\php\\phpstudy\\PHPTutorial\\WWW\\foxphp";
location / {
index index.html index.htm index.php;
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
server {
listen ;
server_name abc.cn;
root "D:\\php\\phpstudy\\PHPTutorial\\WWW\\test";
location / {
index index.html index.htm index.php;
autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
linux-lnmp-nginx 配置
server
{
listen ;
#listen [::]:;
server_name l.cn *.l.cn;
index index.html index.htm index.php default.html default.htm default.php;
root /home/landv/php/fastadmin-weike/public; include rewrite/thinkphp.conf;
#error_page /.html; # Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; } include enable-php-pathinfo.conf; 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/l.cn.log;
}
出现当前权限不足,无法写入配置文件application/database.php解决方法

/user/local/nginx/conf/fastcgi.conf简单粗暴修改这个文件
把fastcgi_param PHP_ADMIN_VALUE值修改即可
fastcgi_param PHP_ADMIN_VALUE "open_basedir=/home/landv/php/fastadmin-weike/:/tmp/:/proc/";
lnmp集成环境默认在最后一行。
因为lnmp默认会在虚拟主机目录创建一个.user.ini文件里面保存的是虚拟主机根目录配置信息
#fastcgi_param PHP_ADMIN_VALUE "open_basedir=$document_root:/tmp/:/proc/" ;
这个可以注释掉他。好吧坑那么多。
还会出现其他文件权限问题,反正测试使用直接给到最大权限,正式使用的时候,只能给部分目录开放权限。
chmod -R 777 *
lnmp .user.ini文件无法删除解决方法
使用命令lnmp vhost del删除虚拟主机后,需要使用ftp或者rm命令删除网站目录,但是却发现网站目录下有个文件.user.ini文件没有自动删除,出现提示rm: cannot remove `http://xxx.com/.user.ini’: Operation not permitted,连手动ftp也无法删除。
问题分析:根据上面的提示判断文件权限已经被锁定,需要先解除锁定。
问题解决:输入以下命令
chattr -i /home/wwwroot/你的网站目录/.user.ini
然后再用rm -rf命令或者FTP去删除就可以了。
隐藏thinkphp的index.php url,可以不用改成和官方的一样
修改lnmp的pathinfo.conf文件
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
修改成
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
thinkphp 隐藏index.php
server {
listen ;
server_name fast.cn ;
root "D:\\php\\phpstudy\\PHPTutorial\\WWW\\thinkphp\\fastadmin-weike\\public";
location / {
index index.html index.htm index.php;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$ last;
break;
}
#autoindex on;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
真正起作用的是这一段配置:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$ last;
break;
}
[nginx]nginx的一个奇葩问题 500 Internal Server Error phpstudy2018 nginx虚拟主机配置 fastadmin常见问题处理的更多相关文章
- nginx提示:500 Internal Server Error错误的解决方法
现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 ...
- 【转】nginx提示:500 Internal Server Error错误的解决方法
本文转自:http://www.jb51.net/article/35675.htm 现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和 ...
- Nginx频繁报“500 Internal Server Error”错误
服务器导致访问量激增,频繁报"500 Internal Server Error"错误.我查了一下nginx的错误日志(apt-get方式安装的nginx的错误日志在/var/lo ...
- phpstudy 500 Internal Server Error 解决办法
版本:phpstudy 2018 报错:500 Internal Server Error 原因:手动选择路径的时候,产生了斜杠不同 (正确:"D:/phpStudy/PHPTutoria ...
- POST 500 Internal Server Error
今天调试公司web后台时发现一个POST 500 Internal Server Error的错误. 本来VS本地调试没有发现这个问题,然后发布到服务器时才出现了.然后找了好久没找到什么原因,再仔细在 ...
- 解决方案:安装wordpress出现500 Internal Server Error
做一个资讯站点的时候遇到一个wordpress不知道算不算常见的问题:程序安装的时候提示500 Internal Server Error 那么最终百度谷歌找到以下解决方案: 安装新版本wordpre ...
- EBS Webservice Timeout,HTTP Server Return "500 Internal Server Error"
http://blog.itpub.net/26687597/viewspace-1207571/ 基于Oracle EBS R12,开发了一个Webservice用于返回某项主数据,当请求的数据量非 ...
- python urllib2导出elasticsearch数据时 返回 "urllib2.HTTPError: HTTP Error 500: Internal Server Error"
0.业务场景 将ES中某个index的某个字段的所有数据,导出到文件中 1.ES数据导出方法简述 ES数据导出方法,我主要找到了以下几个方面,欢迎大家补充: ES官方API:snapshot and ...
- < 配置jupyer notebook遇到的问题 - 500 : Internal Server Error >
< anaconda配置jupyer notebook遇到的问题 - 500 : Internal Server Error > 问题描述: 我的jupyer notebook是在anac ...
随机推荐
- Linux操作系统六大优点
打开百度App,看更多图片 1.免费开源.Linux是一款完全免费的操作系统,任何人都可以从网络上下载到它的源代码,并可以根据自己的需求进行定制化的开发,而且没有版权限制. 2.模块化程度高.Linu ...
- bat 设置多个静态ip
@echo off REM 本地连接名称 set NetName="本地连接 2" REM 默认IP netsh interface ipv4 set address name=% ...
- springboot笔记09——使用aop
什么是AOP? aop(Aspect Oriented Programming)面向切面编程,是OOP(Object-Oriented Programing,面向对象编程)的补充和完善.OOP引入封装 ...
- opencv 源码分析 CUDA可分离滤波器设计 ( 发现OpenCV的cuda真TM慢 )
1. 主函数 void SeparableLinearFilter::apply(InputArray _src, OutputArray _dst, Stream& _stream) { G ...
- 二叉树、B树、B+树、B*树、VAL树、红黑树
二叉搜索树 每个节点只存储一个关键字, 每个节点最多有两个子节点, 左子节点存储的关键字小于本节点存储的关键字 右子节点存储的关键字大于本节点存储的关键字 搜索时,从根节点开始搜索,小于走左结点,大于 ...
- 织梦dedecms是什么?
织梦dedecms是什么?DedeCms是织梦内容管理系统(DedeCms)的简称, 以简单.实用.开源而闻名,是国内最知名的PHP开源网站管理系统,也是使用用户最多的PHP类CMS系统; DedeC ...
- [转].net mvc + vuejs 的项目结构
.net项目结构: 程序目录结构: vue操作: 前提:安装npm ,vue,vue-cli 1.进入控制台窗口 2.进入程序目录 3.运行 vue init webpack webjs 生成webj ...
- robot framework笔记(三):扩展SeleniumLibrary库 (自定义关键字)
(一)自定义和浏览器相关的关键字 以下代码GitHub 版本库地址: https://github.com/blairwind/blog_rf SeleniumLibrary的扩展文档中提供了3种增加 ...
- SQL SERVER-日期按时区转换
SELECT SWITCHOFFSET('2019-07-19 08:35:06.637','+08:00')
- 加标签的continue用法
1.加标签的continue,类似于C语言的goto语句