私はNGINXには比較的新しいですが、私は(24時間以内)認めますが、基本的に設定しました。私は友人のためのサイトを設定しています。下のコードのようなサブドメインを使用するコードの例を見ました。しかし、サブドメインでは、PHPは動作しません。 "subdomain.domain.tld"に行くとファイルをダウンロードするように求められますが、 "subdomain.domain.tld/index.php"に行くと "入力ファイルが指定されていません"と表示されます。ところで、サブドメインはphpmyadminです。NGINX Config 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