nginx 経由でアクセスされる HP クラウド上にdevpiミラーを作成しようとしています。つまり、nginx はポート 80 をリッスンし、同じマシンでポート 4040 を使用している devpi へのプロキシとして使用されます。
hp-cloud のすべてのポート (インバウンドとアウトバウンド) に対して開かれている HP-cloud セキュリティ グループを構成し (最初はもちろん後で変更します)、ubuntu 14 インスタンスを開始しました。
作成したインスタンスにパブリック IP を割り当てました。
pip を使用して devpi-server をインストールし、apt-get を使用して nginx をインストールしました。
私はdevpiのtutuorial page here :
ranの指示に従いdevpi-server --port 4040 --gen-config
、nginx-devpi.confで作成された内容をnginx.confにコピーしました。
次に、を使用してサーバーを起動しましたdevpi-server --port 4040 --start
。
を使用してnginxを開始しsudo nginx
ました。
私の問題は次のとおりです。 nginx と devpi が実行されている hp インスタンスに SSH で接続し、実行するpip install -i http://<public-ip>:80/root/pypi/ simplejson
と成功しました。
しかし、ラップトップから同じコマンドを実行すると、
Downloading/unpacking simplejson
Cannot fetch index base URL http://<public-ip>:80/root/pypi/
http://<public-ip>:80/root/pypi/simplejson/ uses an insecure transport scheme (http). Consider using https if <public-ip>:80 has it available
Could not find any downloads that satisfy the requirement simplejson
Cleaning up...
No distributions at all found for simplejson
Storing debug log for failure in /home/hagai/.pip/pip.log
セキュリティ/ネットワークの問題である可能性があると思いましたがcurl http://<public-ip>:80
、ラップトップと HP インスタンスから実行すると同じものが返されるため、そうではないと思います。
{
"type": "list:userconfig",
"result": {
"root": {
"username": "root",
"indexes": {
"pypi": {
"type": "mirror",
"bases": [],
"volatile": false
}
}
}
}
}
また、HP クラウドで別のインスタンスを起動して実行しようとしpip install -i http://<public-ip>:80/root/pypi/ simplejson
ましたが、ラップトップと同じエラーが発生しました。
この 2 つのケースの違いがわかりません。誰かがこのケースの解決策を持っているか、何が問題なのかを考えていただければ幸いです。
私のnginx.conf
ファイル:
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
server {
server_name localhost;
listen 80;
gzip on;
gzip_min_length 2000;
gzip_proxied any;
#gzip_types text/html application/json;
proxy_read_timeout 60s;
client_max_body_size 64M;
# set to where your devpi-server state is on the filesystem
root /home/ubuntu/.devpi/server;
# try serving static files directly
location ~ /\+f/ {
error_page 418 = @proxy_to_app;
if ($request_method != GET) {
return 418;
}
try_files /+files$uri @proxy_to_app;
}
# try serving docs directly
location ~ /\+doc/ {
try_files $uri @proxy_to_app;
}
location / {
error_page 418 = @proxy_to_app;
return 418;
}
location @proxy_to_app {
proxy_pass http://localhost:4040;
#dynamic: proxy_set_header X-outside-url $scheme://$host:$server_port;
proxy_set_header X-outside-url http://localhost:80;
proxy_set_header X-Real-IP $remote_addr;
}
}
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
# server_names_hash_bucket_size 64;
# server_name_in_redirect off;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
#include /etc/nginx/sites-enabled/*;
}
編集:ラップトップ
から使用しようとしましたが、ラップトップからdevpi-client
実行すると、次のようになります:devpi use http://<public-ip>:80
using server: http://localhost/ (not logged in)
no current index: type 'devpi use -l' to discover indices
~/.pydistutils.cfg : no config file exists
~/.pip/pip.conf : no config file exists
~/.buildout/default.cfg: no config file exists
always-set-cfg: no