[英]Nginx php5.6 fpm show blank page
我想在domain.com/api上与php一起运行node。 我的nginx配置如下
server {
listen 80;
server_name domain.com;
return 301 http://domain.com$request_uri;
}
server {
listen 80;
server_name domain.com;
location / {
proxy_pass http://domain.com:8080;
proxy_redirect off;
proxy_set_header X-Forwarded-For $remote_addr;
location ~* \.(html|css|jpg|gif|ico|js)$ {
proxy_cache cache;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 301 302 30m;
expires 30m;
proxy_pass http://domain.com:8080;
}
}
location ^~ /api {
alias /var/www/html/testphp/api;
try_files $uri $uri/ @api;
location ~* \.php {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_index index.php;
}
}
location @api {
rewrite ^/api/(.*)$ /api/index.php/$1 last;
}
}
但是,当我运行domain.com/api/test.php文件时,是否显示空白页? 如何解决这个问题
我已使此配置完全正常工作。 我正在运行代码点火器,它可以正常工作。
server {
listen 80;
server_name www.domain.com;
root /var/www/html/testphp/api;
location / {
proxy_pass http://www.domain.com:8080;
proxy_redirect off;
proxy_set_header X-Forwarded-For $remote_addr;
location ~* \.(html|css|jpg|gif|ico|js)$ {
proxy_cache cache;
proxy_cache_key $host$uri$is_args$args;
proxy_cache_valid 200 301 302 30m;
expires 30m;
proxy_pass http://www.domain.com:8080;
}
}
location /api/ {
alias /var/www/html/testphp/api/;
try_files $uri $uri/ /api/index.php;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
fastcgi_pass unix:/run/php/php5.6-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.