
下面的为 www.my123.com.conf 文件,为何其它的两个站点,也用的这个模板,都能正常执行 php 文件,而这个一执行 www.my123.com/任意存在的.php 文件,都提示: No input file specified.重启几次都无果。
执行 www.my123.com/.html www.my123.com/.jpg 都正常。
server { listen 80; #listen [::]:80; server_name www.my123.com my123.com; if ($host != 'www.my123.com' ) { rewrite ^/(.*)$ http://www.my123.com/$1 permanent; }
index index.html index.htm index.php default.html default.htm default.php; root /home/wwwroot/www.my123.com;
include other.conf; #error_page 404 /404.html; location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/www.my123.com.log access; } 1 kungfuchicken 2016-11-13 17:25:22 +08:00 via Android fastcgi.conf 内容? |
2 skyboy OP @kungfuchicken fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param QUERY_STRING $query_string; fastcgi_param REQUEST_METHOD $request_method; fastcgi_param CONTENT_TYPE $content_type; fastcgi_param CONTENT_LENGTH $content_length; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_param REQUEST_URI $request_uri; fastcgi_param DOCUMENT_URI $document_uri; fastcgi_param DOCUMENT_ROOT $document_root; fastcgi_param SERVER_PROTOCOL $server_protocol; fastcgi_param HTTPS $https if_not_empty; fastcgi_param GATEWAY_INTERFACE CGI/1.1; fastcgi_param SERVER_SOFTWARE nginx/$nginx_version; fastcgi_param REMOTE_ADDR $remote_addr; fastcgi_param REMOTE_PORT $remote_port; fastcgi_param SERVER_ADDR $server_addr; fastcgi_param SERVER_PORT $server_port; fastcgi_param SERVER_NAME $server_name; # PHP only, required if PHP was built with --enable-force-cgi-redirect fastcgi_param REDIRECT_STATUS 200; |
3 Bardon 2016-11-13 17:51:08 +08:00 php location{}中加个 root 路径进去 你这不贴全,让人家猜的话,很令人苦恼,至少一个站点的配置贴全吧,譬如 other.conf |
4 trepwq 2016-11-13 17:53:12 +08:00 via iPhone 把错误日志打开,看看 access 和 error 日志里请求的 url ,应该是请求的 url 不对 |
5 timestamp 2016-11-14 10:54:46 +08:00 ``` server { listen 80; server_name laravel.dev; root /usr/local/var/www/laravel.dev/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } ``` |
6 licess 2016-11-14 11:14:27 +08:00 可能该虚拟主机网站根目录下.user.ini 里 open_basedir 设置的目录和该虚拟主机配置文件里 root 设置的不一样。 lnmp 问题反馈渠道不对。。要到 https://bbs.vpser.net/forum-25-1.html |
7 baocaixiong 2016-11-14 12:46:28 +08:00 在 nginx 的配置段中加入: location ~ [^/]\.php(/|$) { # comment try_files $uri =404; to enable pathinfo try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; #include pathinfo.conf; return $document_root$fastcgi_script_name; } 然后用 curl 调用,看看你的入口文件是不是正确的指向 |
8 julyclyde 2016-11-14 20:28:24 +08:00 location 不要嵌套!! |