AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 429553
Accepted
Frederik
Frederik
Asked: 2012-09-19 09:20:33 +0800 CST2012-09-19 09:20:33 +0800 CST 2012-09-19 09:20:33 +0800 CST

默认主机的 Nginx /phpmyadmin 目录

  • 772

我的 nginx 服务器有问题。

我是 nginx 的新手,所以配置文件不是我最强大的(还)

我在 /etc/nginx/conf.d/ 中有这个 default.conf:

server {
    listen       80;
    server_name  _;
    #charset koi8-r;
    #access_log  logs/host.access.log  main;
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page  404              /404.html;
    location = /404.html {
        root   /usr/share/nginx/html;
    }
    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #
    location ~ \.php$ {
        root           /usr/share/nginx/html;
        try_files $uri =404;
        fastcgi_pass   unix:/tmp/php5-fpm.sock;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    location ~ /\.ht {
        deny  all;
    }
    location /phpMyAdmin {
    root /usr/share;
    index index.html index.htm index.php;
    }
    location ~ \.php$ {
        root        /usr/share;
        try_files $uri =404;
        fastcgi_pass unix:/tmp/php5-fpm.sock;
        fastcgi_index       index.php;
        fastcgi_param       SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include     fastcgi_params;
    }
}

但是当我访问<ServerIP>/phpMyAdmin它时,它只会给我一个 404。

日志文件是这样的:

2012/09/18 19:12:53 [error] 3184#0: *1 open() "/usr/share/phpMyAdmin/nginx-logo.png" failed (2: No such file or directory), client: 1.2.3.4, server: _, request: "GET /phpMyAdmin/nginx-logo.png HTTP/1.1", host: "4.3.2.1", referrer: "http://4.3.2.1/phpMyAdmin/index.php"

我做错了什么?

nginx
  • 1 1 个回答
  • 2013 Views

1 个回答

  • Voted
  1. Best Answer
    Al_
    2012-09-20T09:04:32+08:002012-09-20T09:04:32+08:00

    这是我的配置中的相关代码。我也很难让它工作,而且我也是 nginx 的新手。

    尝试将尾部斜杠添加到位置部分中根声明的末尾。

    location /phpMyAdmin {
        root /usr/share/;
        index index.php index.html index.htm;
        location ~ ^/phpMyAdmin/(.+\.php)$ {
            try_files $uri =404;
            root /usr/share/;
            fastcgi_pass unix:/tmp/php-fpm.socket;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $request_filename;
            include fastcgi_params;
            fastcgi_param PATH_INFO $fastcgi_script_name;
        }
    
        location ~* ^/phpMyAdmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
            root /usr/share/;
        }
    }
    
    • 1

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve