I'm trying to create a PyPI  (Python) package repository on a Debian 8 server running Nginx 1.6.2.  I want to make all the files in a particular directory tree available for downloading to my other servers via HTTP.  My Python packages are all kept in the /var/www/packages directory:  /var/www/packages /var/www/packages/Django-1.8.4-py2.py3-none-any.whl /var/www/packages/simple /var/www/packages/simple/index.html /var/www/packages/simple/django /var/www/packages/simple/django/Django-1.8.4-py2.py3-none-any.whl -&gt; ../../Django-1.8.4-py2.py3-none-any.whl   If I try to read my packages directory from another server using curl, I get the following error:  $ curl -I http://example.com/packages/simple/django/Django-1.8.4-py2.py3-none-any.whl $ HTTP/1.1 502 Bad Gateway   If I just try to display the Nginx default home page, I'm getting the same error:  502 Bad Gateway   The /var/log/nginx/error.log file shows this error in either case:  2019/02/06 00:53:52 [alert] 3736#0: 768 worker_connections are not enough 2019/02/06 00:53:52 [error] 3736#0: *765 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 127.0.0.1, server: example.com, request: "GET / HTTP/1.0", upstream: "http://127.0.0.1:80/", host: "example.com:80"   Here is my Nginx configuration file:  upstream pypi {   server            127.0.0.1   fail_timeout=0; }  server {   server_name       example.com;   root          /var/www/packages;    location / {     proxy_set_header    Host $host:$server_port;     proxy_set_header    X-Forwarded-Proto $scheme;     proxy_set_header    X-Real-IP $remote_addr;     proxy_pass      http://pypi;          # &lt;- Error here   } }   As I understand it, this error means that Nginx, which is acting as a proxy, is trying to relay information from another server but has received a bad response from that server.  But in this situation, I'm merely trying to make a directory tree on the proxy server available via HTTP so, strictly speaking, there is no other server.  To troubleshoot the problem, I commented out the root directive and the entire location block.  When I did this, the 502 error went away and I could at least see the default Nginx home page. Then I began uncommenting each directive each directive in the location block, one at a time.  By doing this, I found that I could continue to see the Nginx page if I uncommented the entire location block except for the proxy_pass directive.  That proxy_pass line is what's causing the problem.  What does proxy_pass have to be set to in a situation like this?  And do I set root to /var/www/packages since that's the root directory for my packages?
123731
We currently have a web app built to run on an angular framework on Nginx running on Ubuntu 1.10.3. The error log for an attempt to access the site is:  30364#30364: 1000 worker_connections are not enough 30364#30364: *5179370 recv() failed (104: Connection reset by peer) while  reading response header from upstream server:mysite request: "GET /  HTTP/1.1" upstream: myip:80 host:mysite 30364#30364: 1000 worker_connections are not enough 30364#30364: *5179454 no live upstreams while connecting to upstream   My Nginx.conf:  user www-data; worker_processes auto; pid /run/nginx.pid;  events {         worker_connections 1000; }  http{     sendfile on;     tcp_nopush on;     tcp_nodelay on;     keepalive_timeout 65;     types_hash_max_size 2048;      include /etc/nginx/mime.types;     default_type application/octet-stream;ssl_protocols TLSv1 TLSv1.1      TLSv1.2; # Dropping SSLv3, ref: POODLE     ssl_prefer_server_ciphers on;      access_log /var/log/nginx/access.log;     error_log /var/log/nginx/error.log;      gzip on;     gzip_disable "msie6";      include /etc/nginx/conf.d/*.conf;     include /etc/nginx/sites-enabled/*; }   My default.conf:  server {        listen 80 default_server;        listen [::]:80 default_server;         listen 443 ssl;         ssl_certificate /etc/letsencrypt/live/mysite/fullchain.pem;         ssl_certificate_key /etc/letsencrypt/live/mysite/privkey.pem;          root /home/admin_user/myroot;         large_client_header_buffers 4 32k;        index index.html index.htm index.nginx-debian.html;         server_name myserver;         add_header Strict-Transport-Security max-age=500;       location / {             proxy_pass http://mysite;             proxy_http_version 1.1;             proxy_set_header Upgrade $http_upgrade;             proxy_set_header Connection 'upgrade';             proxy_set_header Host $host;             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;              proxy_set_header X-Forwarded-Proto https;        } }   The file structure of my root directory is along these lines. Dashes denote levels. -root   --app     ---controllers  models  services  styles  views   --bower_components   --config   --data   --data.xlsx   --file.jpg   --index.html   --node_modules   --package.json   --Procfile   --public     ---app.js  img   --server.js  This by all means is not a full view of the file structure, but I thought it may be helpful.
42811
Sure I'm not the first one that tried to serve a domain example.com from a example.net/bbb, but I haven't found a solution yet.  My NGINX configuration follows the  and looks something like this:  server {     listen 80;     server_name example.net;     root /path/to/aaa;      location /bbb/ {         proxy_pass http://example.com/;         proxy_set_header Host $host;         proxy_set_header X-Real-IP $remote_addr;     }      location / {         try_files $uri $uri/ /index.html;     }     location ~ \.(svg|ttf|js|css|svgz|eot|otf|woff|jpg|jpeg|gif|png|ico)$ {         access_log off;         log_not_found off;         expires max;     } }   I can manage to render the root of example.com in example.net/bbb but:  ISSUE 1  example.net/bbb/some/path doesn't work as expected and the index.html of example.net is rendered.  ISSUE 2  Any asset in example.com/assets gives 404 because the browser look for example.net/assets. Be great if I could solve this without placing absolute paths everywhere.
21394
hi i try to deploy my django project 2.2v on ubuntu apache server when i run cat /var/log/apache2/error.log i get this error:  [time] [wsgi:error] [pid 13224:tid 2323232] (13)Permission denied: [remote some number:number] mod_wsgi (pid=13323, process='django_app', application='django_project|'): Call to fopen() failed for '/root/project_name/project_name/wsgi.py'.  my wsgi.py import os  from django.core.wsgi import get_wsgi_application  os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'project_name.settings')  application = get_wsgi_application()  This is my /etc/apache2/sites-available/django_proj.conf : &lt;VirtualHost *:80&gt;     Alias /static /root/project_name/static     &lt;Directory /root/project_name/static&gt;         Require all granted     &lt;/Directory&gt;      Alias /meida /root/project_name/meida     &lt;Directory /root/project_name/meida&gt;         Require all granted     &lt;/Directory&gt;      &lt;Directory /root/project_name/zettapc&gt;         &lt;Files wsgi.py&gt;             Require all granted         &lt;/Files&gt;     &lt;/Directory&gt;      WSGIScriptAlias / /root/project_name/project_name/wsgi.py     WSGIDaemonProcess django_app python-path=/root/project_name python-home=/root/project_name/venv/     WSGIProcessGroup django_app   &lt;/VirtualHost&gt;  and output of on my browser is :  Internal Server Error  is there something i've missed please
9081
I have accidently installed Python packages to my system using pip instead of apt-get. I did this in two ways:   using an older version of virtualenv, I forgot to append --no-site-packages when creating the virtualenv - after that when I called pip install, the Python packages where installed to the system rather than the virtualenv in a correctly setup virtualenv, I typed sudo pip install somepackage - the sudo installed to the system rather than the virtualenv   I happened to notice this because I typed pip freeze outside a virtualenv, and spotted some Python packages listed that shouldn't be there. So now my question is:   how do I identify all Python packages that have been erroneously installed on the system (that is, Python packages that appear in the pip freeze list, but were not installed with apt-get)? how do I remove them?
47597
I'm trying install the requests, but I can't do that. I'm using Ubuntu 16.04  I tried to install using  $ sudo pip install requests   and I get the following error   Collecting requests Exception: Traceback (most recent call last):   File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 209, in main     status = self.run(options, args)   File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run     requirement_set.prepare_files(finder)   File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 360, in prepare_files     ignore_dependencies=self.ignore_dependencies))   File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 512, in _prepare_file     finder, self.upgrade, require_hashes)   File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 273, in populate_link     self.link = finder.find_requirement(self, upgrade)   File "/usr/lib/python2.7/dist-packages/pip/index.py", line 442, in find_requirement     all_candidates = self.find_all_candidates(req.name)   File "/usr/lib/python2.7/dist-packages/pip/index.py", line 400, in find_all_candidates     for page in self._get_pages(url_locations, project_name):   File "/usr/lib/python2.7/dist-packages/pip/index.py", line 545, in _get_pages     page = self._get_page(location)   File "/usr/lib/python2.7/dist-packages/pip/index.py", line 648, in _get_page     return HTMLPage.get_page(link, session=self.session)   File "/usr/lib/python2.7/dist-packages/pip/index.py", line 757, in get_page     "Cache-Control": "max-age=600",   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 480, in get     return self.request('GET', url, **kwargs)   File "/usr/lib/python2.7/dist-packages/pip/download.py", line 378, in request     return super(PipSession, self).request(method, url, *args, **kwargs)   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 468, in request     resp = self.send(prep, **send_kwargs)   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 597, in send     history = [resp for resp in gen] if allow_redirects else []   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 195, in resolve_redirects     **adapter_kwargs   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/sessions.py", line 576, in send     r = adapter.send(request, **kwargs)   File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/adapter.py", line 46, in send     resp = super(CacheControlAdapter, self).send(request, **kw)   File "/usr/share/python-wheels/requests-2.9.1-py2.py3-none-any.whl/requests/adapters.py", line 376, in send     timeout=timeout   File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/connectionpool.py", line 610, in urlopen     _stacktrace=sys.exc_info()[2])   File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/util/retry.py", line 228, in increment     total -= 1 TypeError: unsupported operand type(s) for -=: 'Retry' and 'int'   My python version is the 2.7 and the pip is 8.1.1
38670
i installed a new Debian on a small VPS and now when i try to install sudo i just get this message. I also tried to add FTP-Server into the list and i still get that error.  root@srv45758:~# vi /etc/apt/sources.list deb http://ftp.de.debian.org/debian/ jessie main contrib non-free deb http://ftp.de.debian.org/debian/ main contrib non-free deb http://security.debian.org jessie/updates main contrib non-free   Does any one maybe know the problem?
24719
I'm trying to follow the  (on my Ubuntu 10.04 VM).  The first step is:  sudo add-apt-repository ppa:linaro-maintainers/toolchain   But when I run that I get:  Error reading https://launchpad.net/api/1.0/~linaro-maintainers/+archive/toolchain: &lt;urlopen error [Errno 110] Connection timed out&gt;   I'm guessing the problem is with my configuration for my employer's proxy server, particularly for HTTPS.  When I opened  in Firefox, I got "The connection has timed out".  I then went into Firefox Preferences -> Advanced -> Network -> Settings... and set HTTP Proxy to "gateway" and Port to 8080, and checked "Use this proxy server for all protocols".  Then the page loaded.  This supports my theory.  I've tried setting the http_proxy and https_proxy environment variables (both lower and upper case):  $ set | grep -i proxy HTTPS_PROXY=https://gateway:8080 HTTP_PROXY=http://gateway:8080 http_proxy=http://gateway:8080 https_proxy=https://gateway:8080   I also tried changing them to:  $ set | grep -i proxy HTTPS_PROXY=gateway:8080 HTTP_PROXY=gateway:8080 http_proxy=gateway:8080 https_proxy=gateway:8080   And I tried adding this second line to /etc/apt/apt.conf:  Acquire::http::proxy "http://gateway:8080/"; Acquire::https::proxy "https://gateway:8080/";   But I continue to get the same error.  How do I troubleshoot this?  Update: I followed the instructions in the  to  and got further:  $ sudo add-apt-repository ppa:linaro-maintainers/toolchain Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 1DD749B890A6F66D050D985CF1FCBACA7BE1F97B gpg: requesting key 7BE1F97B from hkp server keyserver.ubuntu.com gpgkeys: HTTP fetch error 7: couldn't connect to host gpg: no valid OpenPGP data found. gpg: Total number processed: 0   I wonder if the "HTTP fetch error" means I also need to add "Defaults env_keep = http_proxy" to /etc/sudoers...  Update #2: I added:  Defaults env_keep="http_proxy" Defaults env_keep="https_proxy"   ...as in , but I still get the same "gpgkeys: HTTP fetch error 7: couldn't connect to host" error.  And this is curious:  $ sudo env | grep proxy https_proxy=https://gateway:8080   ...because http_proxy isn't there.  Any advice is appreciated.  Update #3: Since the host of my VM is a laptop, I took it home and tried there (with no proxies):  $ sudo add-apt-repository ppa:linaro-maintainers/toolchain Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg --trustdb-name /etc/apt/trustdb.gpg --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver keyserver.ubuntu.com --recv 1DD749B890A6F66D050D985CF1FCBACA7BE1F97B gpg: requesting key 7BE1F97B from hkp server keyserver.ubuntu.com gpg: key 7BE1F97B: public key "Launchpad Linaro Overlay PPA" imported gpg: Total number processed: 1 gpg:               imported: 1  (RSA: 1)   It worked.  So problem is related to proxy configuration.  But I suppose I have a workaround.
33805
I would like to set up an APT repository on a server that will provide a couple of packages.  Is there a way to set one up without installing any software on the server?  How do the files have to be organized?    Edit: I must be doing something wrong... can someone please help me? I have the repository at   I'm not sure where or what, but something's misconfigured. I only currently have one package and it's for all architectures.  Here's what's been added to my /etc/apt/sources.list:  deb http://quickmediasolutions.com/apt stable main
91821
I'm new to Linux and am trying to set up Python / Django on my machine!  I installed Python 3.3 from the source file and it was compiled into /usr/local/bin. Then I created a symbolic link between /usr/bin/python and /usr/local/bin/python3, so that whenever I invoke python from the command line it uses the latest version.  Now I am trying to install MySQL Python and I got the following output:  apt-get install python-mysqldb  Reading package lists... Done Building dependency tree Reading state information... Done python-mysqldb is already the newest version. The following extra packages will be installed:   apt-listchanges python-apt Suggested packages:   python-glade2 python-gtk2 python-apt-dbg python-vte python-apt-doc The following packages will be upgraded:   apt-listchanges python-apt 2 upgraded, 0 newly installed, 0 to remove and 142 not upgraded. 3 not fully installed or removed. Need to get 0 B/394 kB of archives. After this operation, 250 kB of additional disk space will be used. Do you want to continue [Y/n]? Y Traceback (most recent call last):   File "/usr/bin/apt-listchanges", line 28, in &lt;module&gt;     import apt_pkg ImportError: No module named 'apt_pkg'   Any ideas on how to fix this?  Or any tips on how to clean up this install (if this one is too broken)?
35759
I have a running web-application at http://example.com/, and want to "mount" another application, on a separate server on http://example.com/en. Upstream servers and proxy_pass seem to work, but for one issue:  upstream luscious {  server lixxxx.members.linode.com:9001; }  server {   root /var/www/example.com/current/public/;   server_name example.com;    location /en {     proxy_pass http://luscious;   } }   When opening example.com/en, my upstream application returns 404 not found /en. This makes sense, as the upstream does not have the path /en.   Is proxy_path the right solution? Should I rewrite "upstream" so it listens to /en instead, as it root path? Or is there a directive that allows me to rewrite the path passed along to upstream?
65306
I am trying to apt-get update but it gets stuck on   0% [Connecting to ph.archive.ubuntu.com (202.90.159.172)]  and after a couple of minutes it gives me the following:  Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]      Hit:2 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease Err:3 http://ph.archive.ubuntu.com/ubuntu xenial InRelease                        Could not connect to ph.archive.ubuntu.com:80 (2001:d18:0:23::172). - connect (101: Network is unreachable) [IP: 2001:d18:0:23::172 80] Err:4 http://ph.archive.ubuntu.com/ubuntu xenial-updates InRelease   Unable to connect to ph.archive.ubuntu.com:http: [IP: 2001:d18:0:23::172 80] Err:5 http://ph.archive.ubuntu.com/ubuntu xenial-backports InRelease   Unable to connect to ph.archive.ubuntu.com:http: [IP: 2001:d18:0:23::172 80] Fetched 102 kB in 2min 0s (846 B/s)                       Reading package lists... Done W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/xenial/InRelease  Could not connect to ph.archive.ubuntu.com:80 (2001:d18:0:23::172). - connect (101: Network is unreachable) [IP: 2001:d18:0:23::172 80] W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/xenial-updates/InRelease  Unable to connect to ph.archive.ubuntu.com:http: [IP: 2001:d18:0:23::172 80] W: Failed to fetch http://ph.archive.ubuntu.com/ubuntu/dists/xenial-backports/InRelease  Unable to connect to ph.archive.ubuntu.com:http: [IP: 2001:d18:0:23::172 80] W: Some index files failed to download. They have been ignored, or old ones used instead.   I have tried disabling IPV6 connection as described  but it doesn't seem to fix the problem. What should I do? I'm an Ubuntu newb and using 16.04.
90618
What is the best way to install Python packages in Ubuntu 11? I am a recent convert to Ubuntu and want to learn best practices.  For context, I am looking to install the tweeststream package, but I did not see it in my Synaptic package manager. Also, I am very new to programming, but I usually can follow along with code samples.
13555
I'm trying to install PIL a python module on ubuntu   I first need to install a package called python-imaging using the following command    sudo apt-get build-dep python-imaging   When I try and do this I get the error   E: You must put some 'source' URIs in your sources.list   I saw  question whihc shows how to fix via the GUI but I'm using the command line. Does anyone know how I can fix this error..?    UPDATE: Based on the below answers I've updated my package list but I now get this error. Not sure if it is related, if not I'll start a new question as I can't find reference to the error anywhere.   E: Build-Depends dependency for python-imaging cannot be satisfied because candidate version of package python-all-dev can't satisfy version requirements
63892
I would like to build my own local repository on my LAN, so that machines on the LAN can update and upgrade from it. I want to download the packages and store them on my local server so that I can update, upgrade, install, etc, from it without using the internet.
102858
Somehow my Ubuntu install can't find what I believe to be very common packages....  E: Unable to locate package php5-curl E: Unable to locate package php5-gd   I know this has something to do with my sources, however, I am not sure which source I need or which source these packages would be included in.  These are the commands I ran  sudo apt-get install php5-curl sudo apt-get install php5-gd   Here's the content of /etc/apt/sources.list:  # deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ dists/oneiric/main/binary-i386/  # deb cdrom:[Ubuntu 11.10 _Oneiric Ocelot_ - Release amd64 (20111012)]/ oneiric main restricted  # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution.  ## Major bug fix updates produced after the final release of the ## distribution.  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team.  ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu  ## team, and may not be under a free licence. Please satisfy yourself as to  ## your rights to use the software. Also, please note that software in  ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team.  ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team.   ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu oneiric partner # deb-src http://archive.canonical.com/ubuntu oneiric partner  ## This software is not part of Ubuntu, but is offered by third-party ## developers who want to ship their latest software. # deb http://extras.ubuntu.com/ubuntu oneiric main # deb-src http://extras.ubuntu.com/ubuntu oneiric main  # deb http://repository.spotify.com stable non-free
75953
I have 20 to 3o computers on my network and I have a copy of the debian packages on /var/cache/apt/archives but when I take this downloaded copy to any other machine I need to hit an "apt-get update" , How do I avoid this ? Where is the list of packages which is updated by that command stored. I need to copy them as well, and use it on a computer which is completely offline.
32222
I need to configure proxy. There wasn't apt.conf file in etc/apt/ so I've created it using nano.   But I don't understand what I need to write there. I've written  http_proxy = http://lgn:pwd@192.168.1.254:8080/ there and then restarted networking. But when I try to apt-get update - it doesn't work.   Actually I don't understand what port and ip I should write in apt.conf file(there was example with 192.168.1.254 ip and 8080 port so I decided to use them).