簡體   English   中英

nginx無法連接到phpmyadmin

[英]nginx cant connect to phpmyadmin

我在使用當前的nginx配置連接到phpmyadmin時遇到問題。

在/ etc / nginx的/啟用的站點- / couponmonk_project

server {

    error_log /var/log/nginx/error.log debug;
    access_log /var/log/nginx/access.log;

    location / {
    proxy_pass http://localhost:8000;
        proxy_redirect off;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location /static {
        alias  /home/giri/couponmonk_project/couponmonk_project/static;
    }

    location /phpmyadmin {
        root /usr/share/nginx/www;        
        index  index.html index.htm index.php;        
    }

    # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
    location ~ \.php$ {
       try_files $uri =404;
       fastcgi_pass unix:/var/run/php5-fpm.sock;
       fastcgi_index index.php;
       fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
       include fastcgi_params;
    }

    location /socket.io {
        proxy_pass http://localhost:8000/socket.io;
        proxy_redirect off;
        proxy_buffering off;

        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
    }

}

當我嘗試使用my_ip_address/phpmyadmin訪問phpmyadmin ,出現404 Not Found錯誤。 我的其他路徑似乎運行良好。

文件夾/usr/share/nginx/www/phpmyadmin包含index.php文件。 作為快速測試,我在此處插入了index.html文件,並正確顯示了該文件。

fastcgi_params嗎? 我不確定如何/是否應該編輯該文件。

關於我應該嘗試的任何想法將不勝感激。

意識到我只需要移動:

location ~ \.php$ {
...
}

內:

location /phpmyadmin {
....
}

.conf文件

server {

  error_log /var/log/nginx/error.log debug;
  access_log /var/log/nginx/access.log;

  location / {
    proxy_pass http://localhost:8000;
      proxy_redirect off;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
  location /static {
      alias  /home/giri/couponmonk_project/couponmonk_project/static;
  }

  location /phpmyadmin {
      root /usr/share/nginx/www;        
      index  index.html index.htm index.php;        

     # pass the PHP scripts to FastCGI server listening on /var/run/php5-fpm.sock
     location ~ \.php$ {
     try_files $uri =404;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include /etc/nginx/fastcgi_params;
     }
  }


  location /socket.io {
      proxy_pass http://localhost:8000/socket.io;
      proxy_redirect off;
      proxy_buffering off;

      proxy_set_header Host $host;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

      proxy_http_version 1.1;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection "Upgrade";
  }

}

暫無
暫無

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

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