nginx下绑定域名解析不了php

Linux VPS 支持
回复
tankywoo
帖子: 24
注册时间: 2012-03-23 17:33

nginx下绑定域名解析不了php

#1

帖子 tankywoo » 2012-06-07 18:56

今天弄了一天nginx绑定域名,按照网上的方法, 但是还有几个问题。

先给大家看看我按照网上写的配置文件,域名是hellovim.org,在dnspod上做了泛解析*.hellovim.org

先给出我按照网上写的配置文件:

代码: 全选

server {
        listen  80;
        server_name  hellovim.org www.hellovim.org wtq.hellovim.org;

        #access_log  /var/www/access_hellovim.log;

        location / {
            root   /var/www/hellovim.org;
            index  index.php index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }

       # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /var/www/hellovim.org/$fastcgi_script_name;
            include        fastcgi_params;
        }

        location ~ /\.ht {
            deny  all;
        }
}
直接加在了site-available/default中,这个是默认的配置文件。

然后现在有两个问题:

1、我可以访问hellovim.org/index.html hellovim.org/test.html
但是对于php文件如hellovim.org/p.php就访问不了。

这些都是根目录下有的。
但是我又可以通过ip路径来访问:http://184.22.140.38/hellovim.org/p.php


刚才对dnspod的泛解析改成了@和www记录,现在hellovim.org可以访问了
2.我的域名做了泛解析,而且配置文件也写了这三个:
server_name hellovim.org http://www.hellovim.org wtq.hellovim.org;

现在www.hellovim.org wtq.hellovim.org可以访问,但是hellovim.org访问不了


希望大家能帮忙看看,谢谢了。
头像
sleepsun
帖子: 25
注册时间: 2009-06-22 17:03

Re: nginx下绑定域名解析不了php

#2

帖子 sleepsun » 2012-06-17 1:52

这么久都没人回复……还是搞个LNMPA一键安装包吧。省事快捷,负载能力还强。
头像
link_01
帖子: 1024
注册时间: 2008-11-05 13:24

Re: nginx下绑定域名解析不了php

#3

帖子 link_01 » 2012-06-17 10:42

hellovim.org/p.php应该这么访问吧?
笔记
-------------------------------------
http://blog.163.com/wqt_1101
头像
xjpvictor
帖子: 2837
注册时间: 2007-08-22 15:55
系统: Archlinux
来自: 新加坡
联系:

Re: nginx下绑定域名解析不了php

#4

帖子 xjpvictor » 2012-06-17 11:09

把root /var/www/hellovim.org;放到location外面来试试
Entschuldigung. Ich habe keine ahnung.
Secure with PGP: gpg --recv-keys 0x68b6e3d8
Fingerprint: 5556 517C F52F E402 DDF5 5400 6D30 F13E 68B6 E3D8
Towards A Sustainable Earth: Print Only When Necessary
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

Re: nginx下绑定域名解析不了php

#5

帖子 oneleaf » 2012-06-17 11:45

小李世界
帖子: 5
注册时间: 2016-03-30 17:04
系统: Mac

Re: nginx下绑定域名解析不了php

#6

帖子 小李世界 » 2016-03-30 17:47

fastcgi_pass 127.0.0.1:9000;
这个不对
回复