VPS侦探论坛

标题: 连接Phpmyadmin就显示404 not found [打印本页]

作者: rapwaydown    时间: 2015-2-19 12:19
标题: 连接Phpmyadmin就显示404 not found
ip/phpmyadmin 就404, 我看过了, phpmyadmin 是在/home/wwwroot/default/,其他在/home/wwwroot/default/下的都可以用IP来访问,比如p.php, 就是phpmyadmin不行。上网搜了很多教程,没有一个可以解决这个问题。只能来麻烦军哥你了, 下面是配置:

server

{

listen 80;

server_name 1.1.1.1;

index index.html index.htm index.php default.html default.htm default.php;

root  /home/wwwroot/default/;


#error_page   404   /404.html;



location ~ [^/]\.php(/|$)

{

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}


location / {

allow 2.2.2.2;

deny all;

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}


location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}


location ~ .*\.(js|css)?$

{

expires      12h;

}


}

[ 本帖最后由 rapwaydown 于 2015-2-19 22:02 编辑 ]
作者: licess    时间: 2015-2-20 20:46
  1. location / {

  2. allow 2.2.2.2;

  3. deny all;

  4. # comment try_files $uri =404; to enable pathinfo

  5. try_files $uri =404;

  6. fastcgi_pass  unix:/tmp/php-cgi.sock;

  7. fastcgi_index index.php;

  8. include fastcgi.conf;

  9. #include pathinfo.conf;

  10. }
复制代码

去掉,重启
作者: rapwaydown    时间: 2015-2-21 03:59
原帖由 licess 于 2015-2-20 20:46 发表
location / {

allow 2.2.2.2;

deny all;

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf ...

这段代码哪里错了吗, 我只想让我自己的IP可以访问phpmyadmin。
作者: licess    时间: 2015-2-21 17:20
标题: 回复 3# 的帖子
不是指定目录的话
allow 2.2.2.2;
deny all;
直接加到
server段root下面就行

指定目录参考:https://www.vpser.net/build/nginx-htpasswd.html 将里面的auth_basic相关的去掉,提供成allow和deny就行了。
作者: rapwaydown    时间: 2015-2-24 02:06
原帖由 licess 于 2015-2-21 17:20 发表
不是指定目录的话
allow 2.2.2.2;
deny all;
直接加到
server段root下面就行

指定目录参考:https://www.vpser.net/build/nginx-htpasswd.html 将里面的auth_basic相关的去掉,提供成allow和deny就行了。 ...


server

{

listen 80;

server_name 1.1.1.1;

index index.html index.htm index.php default.html default.htm default.php;

root  /home/wwwroot/default/;

allow 2.2.2.2;

deny all;

error_page 403 http://a.com/;


#error_page   404   /404.html;


location ~ [^/]\.php(/|$)

{

# comment try_files $uri =404; to enable pathinfo

try_files $uri =404;

fastcgi_pass  unix:/tmp/php-cgi.sock;

fastcgi_index index.php;

include fastcgi.conf;

#include pathinfo.conf;

}


location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

{

expires      30d;

}


location ~ .*\.(js|css)?$

{

expires      12h;

}}

现在改成这样, phpmyadmin可以访问了, 但是p.php,phpinfo.php还有xcache就都404了

[ 本帖最后由 rapwaydown 于 2015-2-24 02:27 编辑 ]
作者: licess    时间: 2015-2-24 09:03
标题: 回复 5# 的帖子
看4楼,我已经说过了




欢迎光临 VPS侦探论坛 (https://bbs.lnmp.com/) Powered by Discuz! X3.4