簡體   English   中英

phpmyadmin和nginx沒有提供輸入文件

[英]phpmyadmin and nginx gives no input file

這是我的主要配置文件

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  mysite.com www.mysite.com;
        root          /home/mysite/www;
        sendfile off;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        index index.php index.html index.htm;
        location / {
        }
        location /pma {
            alias /usr/share/phpmyadmin;
            location ~ \.php$ {
                try_files $uri @php;
            }
        }
        location @php {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass php-fpm;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_intercept_errors off;
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

phpmyadmin文件位於/ usr / share / phpmyadmin /中,如果我訪問www.mysite.com/pma/,則沒有指定輸入文件,並且出現錯誤日志:

2016/06/12 15:48:47 [error] 15999#0: *1 FastCGI sent in stderr: "Unable to open primary script: /home/mysite/www/pma/index.php (No such file or directory)" while reading response header from upstream, client: my-ip, server: mysite.com, request: "GET /pma/ HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "my server ip"

我已經嘗試了一切,用root更改別名也無濟於事,它是將index.php文件下載到名為“ download”的文件中,我讀過我應該使用別名而不是root。 但這似乎並不能解決我的問題...

編輯我也有這個default.d里面包括

# pass the PHP scripts to FastCGI server
#
# See conf.d/php-fpm.conf for socket configuration
#
index index.php index.html index.htm;

location ~ \.php$ {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    try_files $uri =404;
    fastcgi_intercept_errors on;
    fastcgi_index  index.php;
    include        fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_pass   php-fpm;
}

請更改別名為root,並確保/ usr / share / pma中的phpmyadmin正確路徑。 在此配置中,使用套接字php-fpm。 對不起,我英語不好

# # configure phpmyadmin path
    location /pma {
    root /usr/share;
    index index.php;
    location ~ ^/pma/(.+\.php)$ {
        try_files $uri $uri/ /index.php?$args;
        root /usr/share;
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        #fastcgi_param PATH_INFO $fastcgi_script_name;
        include fastcgi_params;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 4k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
    }
    location ~* ^/pma/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
        root /usr/share;
        }
    } 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM