![Raspberry Pi、Mercurial 和 nginx](https://linux22.com/image/1349340/Raspberry%20Pi%E3%80%81Mercurial%20%E5%92%8C%20nginx.png)
我在这里发布这篇文章,因为显然我不太可能得到任何帮助树莓派。请多多包涵。
我在配置 Mercurial 以使用 raspberry pi 上的 unix 套接字与 nginx 配合使用时遇到了一个小问题。http://myip/hg
通过 Web 浏览器访问时,出现 502 Bad Gateway 错误,error.log 显示以下错误:
连接到上游时,连接到 unix:/srv/hg/mercurial.sock 失败(111:连接被拒绝),客户端:myPCIP,服务器:localhost,请求:“GET /hg/HTTP/1.1”,上游:“fastcgi://unix:/srv/hg/mercurial.sock:”,主机:“myServerIP”
我似乎不知道哪里出了问题。
哦,这是我的默认网站配置:
server {
#listen 80; ## listen for ipv4; this line is default and implied
#listen [::]:80 default_server ipv6only=on; ## listen for ipv6
root /usr/share/nginx/www;
index index.html index.htm;
# Make site accessible from http://localhost/
server_name localhost;
# mercurial setup
location /hg {
root /srv/hg/;
auth_basic "Secure Login";
auth_basic_user_file /srv/hg/hgusers;
fastcgi_pass unix:/srv/hg/mercurial.sock;
fastcgi_param SCRIPT_FILENAME /srv/hg/$fastcgi_script_name;
fastcgi_param PATH_INFO $uri;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param DOCUMENT_ROOT /srv/hg/;
include fastcgi_params;
client_max_body_size 20M;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
include fastcgi_params;
}
}