Giter VIP home page Giter VIP logo

Comments (5)

webysther avatar webysther commented on May 23, 2024 4

Hi @cameronwilby, there a feature, i lack to explain on a tutorial to create your own mirror, next few days i fixed this problem.

The mirror creation save all data as .gz to save disk space, you need to enable reverse gz decode when a client ask for the decompressed version.

To do this, change you nginx configuration of gzip_static and gunzip as is:

server {
    index.html;

    server_name packagist.com.br www.packagist.com.br;

    location / {
        try_files $uri $uri/ =404;
        gzip_static on;
        gunzip on;
    }
}

Source:
http://nginx.org/en/docs/http/ngx_http_gunzip_module.html
http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html

from packagist-mirror.

cwilby avatar cwilby commented on May 23, 2024 1

This is the output I get:

Composer version 1.6.5 2018-05-04 11:44:59


  [Seld\JsonLint\ParsingException]
  "" does not contain valid JSON
  Parse error on line 1:
  composer
  ^
  Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['


config [-g|--global] [-e|--editor] [-a|--auth] [--unset] [-l|--list] [-f|--file FILE] [--absolute] [--] [<setting-key>] [<setting-value>]...```

from packagist-mirror.

cwilby avatar cwilby commented on May 23, 2024

@webysther that did the trick, thank you! Here is the nginx config I ended up with:

server {
	listen 80;
	listen [::]:80;

	root /var/www/html;
	index index.php index.html index.htm;

	server_name packagist.com.br;

	location / {
		try_files $uri $uri/ =404;
		gzip_static on;
		gunzip on;
	}

	error_page 404 /404.html;
	error_page 500 502 503 504 /50x.html;
	location = /50x.html {
		root /usr/share/nginx/html;
	}

	location ~ \.php$ {
	        include snippets/fastcgi-php.conf;
        	fastcgi_pass unix:/run/php/php7.2-fpm.sock;
	}

	listen [::]:443 ssl ipv6only=on
	listen 443 ssl;
	ssl_certificate /etc/letsencrypt/live/packagist.com.br/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/packagist.com.br/privkey.pem;
	include /etc/letsencrypt/options-ssl-nginx.conf;
	ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

from packagist-mirror.

webysther avatar webysther commented on May 23, 2024

Great @cameronwilby! Another tip is using a machine with 2GB at least of memory. With that all metadata keep to the memory helping the nginx and disk to not be consumed.

from packagist-mirror.

cwilby avatar cwilby commented on May 23, 2024

Good to know, I went with the 2GB droplet on DigitalOcean 👍 Thanks again @webysther, awesome work.

from packagist-mirror.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.