我對NGINX比較新,我承認(不到24小時),但是,我已經基本配置好了。我爲一位朋友設立了一個網站,並且我看到了一些使用子域名的代碼示例,如下面的代碼所示。但是,在子域中,PHP不起作用。它只是要求我下載文件,如果我去「subdomain.domain.tld」,但是,如果我去「subdomain.domain.tld/index.php」,它說「沒有指定輸入文件。」順便說一下,該子域是phpmyadmin。NGINX配置PHP故障
server {
listen 80;
server_name irc.physibots.info;
rewrite (.*) http://physibots.info:3989;
}
server {
listen 80;
server_name "~^([a-z]+)?.physibots.info";
root /home/virtual/physibots.info/subdomains/$1;
index index.php index.html index.html;
location/{
autoindex on;
}
location ~ \.php {
try_files $uri /error.html
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php.socket;
include fastcgi_params;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
#server {
# listen 443;
# server_name localhost;
#
# charset utf-8;
#
# ssl on;
# ssl_certificate
server {
listen 80;
server_name physibots.info default;
root /home/virtual/physibots.info/public_html;
index index.php index.html index.html;
location/{
autoindex on;
}
location ~ \.php {
try_files $uri /error.html
fastcgi_index index.php;
fastcgi_pass unix:/tmp/php.socket;
include fastcgi_params;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
您是否嘗試從相同的子域訪問靜態文件?如果靜態文件服務良好,問題是在fastcgi配置,如果不是,它在nginx配置,這將是很好知道:) – petermolnar