nginx的php讀取問題 - Linux

Table of Contents

小弟環境是Centos 7
如果是指定ip: http://192.168.1.1/test.php 可以讀取
但如果用網域就會讓你下載 http://test.ptt.com/test.php

location ~ \.php$ {
root /vhost/test.ptt.com/htdocs;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;

try_files $uri =404;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


請問該如何是好 感謝各位!

--

All Comments

Connor avatarConnor2016-12-31
有沒有可能是有別的web server也在運行?apache?
Una avatarUna2016-12-31
你有指定server_name嗎?
Agatha avatarAgatha2017-01-02
server_name .ptt.com
沒有apache
Olivia avatarOlivia2017-01-04
CentOS不知道有沒有和ubuntu一樣long-term support版本
Carolina Franco avatarCarolina Franco2017-01-07
Kernel Version?????????????????????????????????????
Vanessa avatarVanessa2017-01-09
修改www.conf
listen=/var/run/php-fpm/php-fpm.sock
user=nginx
group=nginx
listen.owner=nginx
listen.group=nginx
listen.mode=0660
Olivia avatarOlivia2017-01-12
問題應該是在外層的server設定,方便貼完整的conf嗎?
Leila avatarLeila2017-01-14
centos 本身就是 long-term support 的版本啊...
Tristan Cohan avatarTristan Cohan2017-01-15
另外www.conf設定是一樣的
Ingrid avatarIngrid2017-01-20
你test.ptt.com可以正常解到192.168.1.1吼
Carol avatarCarol2017-01-24
其實我指向過內網IP 還是一樣 所以現在我是指外網IP
Anthony avatarAnthony2017-01-25
把server_name整個拿掉試試
Olga avatarOlga2017-01-27
root 路徑不要用域名看看