2016-06-12 52 views
0

這是我主要的conf文件的phpmyadmin和nginx的沒有給出輸入文件

# 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 /共享/ 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" 

我用盡了一切,改變別名有根還沒有幫助,它被下載index.php文件到一個名爲「下載」文件 我讀過我應該使用別名而不是root。但它似乎並沒有解決我的問題......

編輯 我也有包括

# 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; 
} 
+0

這是一項正在進行的工作嗎?因爲我看不到你的main(非phpmyadmin)應用程序應該如何運行'.php'文件。 –

+0

請參閱編輯的回覆 – John

回答

0

請更改別名根,並確保正確的路徑到你的phpmyadmin這裏面default.d在/ usr/share/pma中。 在這個配置中使用套接字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; 
     } 
    }