本地apache,换成nginx1.0.11,
配置文件如下:
#user nobody;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8080;
server_name localhost;
charset utf-8;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm index.php;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /index2.html;
location = /index2.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root D:\test;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}
最主要的是:
1. 更改php.ini
首先php.ini的配置中把
;cgi.fix_pathinfo=0 改为
cgi.fix_pathinfo=1
2. 在nginx/conf/nginx.conf 找到:
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 改为:
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
分享到:
相关推荐
nginx提示No input file specified怎么办.docx
今天在自己本地的开发环境突然出现了No input file specified错误,反复检查返现自己的配置文件和配置路径以及权限都没有问题。经过反复的排查终于发现了问题,现将问题及解决分享如下: 问题原因分析 在GitHub上...
【LNMP】提示Nginx PHP “No input file specified”错误的解决办法
我用的是ubuntu18.04安装nginx 一般来说我们安装的nginx文件结构大致是这样的: 1. 所有的配置文件都在/etc/nginx下,并且每个虚拟主机已经安排在了/etc/nginx/sites-available下 2. 程序文件在/usr/sbin/nginx 3...
介绍nginx的命令try_file实现本地资源不存在时就跳转到其他流程回源
Restarting nginx daemon: nginxcat: /usr/local/nginx/logs/nginx.pid: No such file or directorykill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec … or kill -l [sigspec]nginx not ...
通过编写shell脚本定时比对新老IP自动对nginx进行reload有效解决了nginx对动态域名不重新解析的问题,附带详细说明
解决nginx+php-fpm无法上传文件问题.docx
nginx+php-fpm解决502 Bad Gateway.zip
nginx config file xiangxishuoming
Nginx常见的错误和解决方法,1、Nginx 常见启动错误 有的时候初次安装nginx的时候会报这样的错误 sbin/nginx -c conf/nginx.conf 报错内容:sbin/nginx: error while loading shared libraries: libpcre.so.1: ...
nginx+php,让nginx支持PHP的PATHINFO路由模式_亲测成功.zip apache+php支持PATHINFO路由模式非常容易,但是nginx对pathinfo可不支持,需要你自己配置正则路径.看看我怎么配的
nginx 1.13.9 配置了php, 包含nginx的启动,关闭,重载的bat文件和php的启动,重新加载的bat,vbs文件。php进程用的端口号是9900.默认php7的安装是c:\php7.要修改php_start.vbs中php的路径。 createobject("wscript....
解决Nginx启动脚本在redhat上无法启动的问题
教你如何在linux下配置nginx服务器和php的环境
windows下 php+nginx配置详解,经整理修改测试通过,希望和大家一起分享!
资源是php+nginx的开发运行环境,应该适用于所有windows系统(本人测试w7+w10+w2003). 获取到资源后,应修改几个文件。 1、PHPServer\nginx\conf 下的nginx.conf进行编辑。 约44行 root--》修改成为你的PHP...
Debian 5 VPS下的Nginx+PHP+MySQL的解决方案