[英]Configuring adminer with NGINX: "no port in upstream php" error
I have set up MeteorJs application with MongoDB backend in Digital Ocean.我已经在 Digital Ocean 中使用 MongoDB 后端设置了 MeteorJs 应用程序。 I am now trying to set up adminer so I can query MongoDB without opening input ports on my droplet.
我现在正在尝试设置 adminer,这样我就可以在不打开 Droplet 上的输入端口的情况下查询 MongoDB。 Everytime I try to reload the nginx settings, I get
nginx: [emerg] no port in upstream "php" in /etc/nginx/sites-enabled/admin:32
error.每次我尝试重新加载 nginx 设置时,我都会收到
nginx: [emerg] no port in upstream "php" in /etc/nginx/sites-enabled/admin:32
错误。 What am I missing?我错过了什么?
/etc/nginx/sites-enabled/admin /etc/nginx/sites-enabled/admin
server {
listen 80;
server_name 165.227.197.220;
return 301 https://$server_name$request_uri;
}
server {
server_name 165.227.197.220;
listen 443 ssl;
access_log /var/log/nginx/admin.access.log;
error_log /var/log/nginx/admin.error.log;
ssl_certificate /etc/nginx/ssl/admin.crt;
ssl_certificate_key /etc/nginx/ssl/admin.key;
root /var/www/admin;
index adminer.php;
# Get file here https://codex.wordpress.org/Nginx
include global/restrictions.conf;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd/admin;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php;
fastcgi_index adminer.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
/etc/nginx/global/restrictions.conf /etc/nginx/global/restrictions.conf
# Global restrictions configuration file.
# Designed to be included in any server {} block.
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
You need to setup an upstream for example using wordpress that is what we have您需要设置一个上游,例如使用我们所拥有的 wordpress
upstream index_php_upstream {
server 127.0.0.1:8090; # NGINX Unit backend address for index.php with
# 'script' parameter
}
For more about upstream, so can view this article UpStream - Nginx有关上游的更多信息,可以查看这篇文章UpStream - Nginx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.