希望您能提供帮助,但在尝试访问博客的管理部分时,我会收到以下错误。
未指定输入文件。
实际的博客工作正常但不是登录/管理区域。
根据标题,博客在单独的服务器上是主域名,并使用代理传递将请求转发给它。
upstream blog {
server 111.111.111.111:443 weight=2 max_fails=3 fail_timeout=60s;
}
server{
...
location /blog {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://blog;
}
}
我在博客服务器上的nginx设置如下。
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.domain.com;
root /home/www.domain.com/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /blog/index.php?$query_string;
}
error_log /var/log/nginx/www.domain.com-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
以下是fastcgi_params,如果它也有帮助。
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_FILENAME $request_filename;
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 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;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param HTTP_PROXY "";
据我所知,我认为PHP无法找到index.php文件?
希望有人可以提供帮助..
答案 0 :(得分:1)
您应该只能指定index index.php;
。
您还应将location / { try_files $uri $uri/ /blog/index.php?$query_string; }
更改为location / { try_files $uri $uri/ /blog/index.php?$args; }
并改变:
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
为:
fastcgi_split_path_info ^(/blog)(/.*)$;
fastcgi_pass php;
答案 1 :(得分:0)
可能会重写/ blog路径来压缩前缀?
server{
...
location /blog {
#strip the '/blog' prefix
rewrite /blog/(.*) /$1 break;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://blog;
}
}
答案 2 :(得分:0)
原因是上游不允许任何其他参数,即扩展名.php,这是上游位置的变化..
location ^~ /blog {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_pass https://blog;
}
希望将来能有所帮助。