我无法使用当前的phpmyadmin
配置连接到nginx
。
的/ 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";
}
}
当我尝试使用phpmyadmin
访问my_ip_address/phpmyadmin
时,出现404 Not Found
错误。我的其他路径似乎工作正常。
文件夹/usr/share/nginx/www/phpmyadmin
包含index.php
文件。作为一个快速测试,我在此处插入了一个index.html
文件,并且它已正确显示。
是否与fastcgi_params
有关?我不确定应该如何编辑这个文件。
对于我应该尝试的任何想法都将非常感激。
答案 0 :(得分:0)
意识到我只需要移动:
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";
}
}