0.起因

pixiv于最近不知道更换了什么,原有的免服务器上Pixiv都失效了,不过好在github.com/mashirozx/Pixiv-Nginx的作者和github.com/CeuiLiSA/Pixiv-Shaft 的作者都较快地更新了上面的项目,因此如果大家在用上面几个软件时遇到问题,可以试试看更新到最新版。

但我又想到github的部分功能是否这样就能复活呢?答案是肯定的。

1.快速教程

Step1. 前往 https://github.com/mashirozx/Pixiv-Nginx Clone Zip下来。

Step2. 用你喜欢的方式(比如XCA),详情可Google一下xca或OpenSSL生成证书(注:OpenSSL有坑,一定要确保生成出来的证书版本是V3,否则不支持SAN(使用者备用名称),详细见https://www.cnblogs.com/real-bert/p/11807225.html

如不会请复制以下内容到conf\ca\github.txt文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
-----BEGIN CERTIFICATE-----
MIIDdjCCAl6gAwIBAgIIO0kp5hTXCQMwDQYJKoZIhvcNAQELBQAwHjEcMBoGA1UE
AxMTdHV0b3JpYWwudGVzdC5sb2NhbDAeFw0yMTAyMDgwMzU3MDBaFw00MDAyMDgx
ODU3MDBaMB4xHDAaBgNVBAMTE3R1dG9yaWFsLnRlc3QubG9jYWwwggEiMA0GCSqG
SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDS+FN7M/jMjrM3nc+TSPd+1+SMYSxHG0DF
AJ+Nc6xBv05285br+7verHcbAvAj/YGz2bzNmqwR1suYawhNK5+BfL1QHCCpY0Aa
zuTVMWn2cSE7CZcwYfdq/Y18AlS5pOLzWS8bHUU9X8YNYfQT+B9nt+QfWBRg1Bez
eAj+29nWQHqJuzN45ZOUxeJNQk6QoobKBjBmR+lNkoNNMGuruCxWFO6zawZ2lyBZ
lGIHbh6KXCH1McSP28EKjpbjQVPl9PT7zMqx4gBpxByim9MIY+OkopxBQw7J3iGY
h8zVvCcAeOKfv1wBdw9q/Am5wP3iznm/Fta6o+natgWNIL4fln8jAgMBAAGjgbcw
gbQwCwYDVR0PBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjCB
hQYDVR0RBH4wfIIXKi5naXRodWJ1c2VyY29udGVudC5jb22CFWdpdGh1YnVzZXJj
b250ZW50LmNvbYIJZ2l0aHViLmlvggsqLmdpdGh1Yi5pb4IMKi5naXRodWIuY29t
ggpnaXRodWIuY29tghhvbmx5LXlvdS5waTc5NzMyNTQ1Ni54eXowDQYJKoZIhvcN
AQELBQADggEBAJ1Y+DDqG7YkpoRCXu29eThRvfgGYYPQdNgRNZO+ooT3myt/yl0+
AFMfZtF+m3bwlVLwUIVp2+ddQCT3pEtFEijaWj/RD02tWbjkKE73xtRktPlGgBmb
SYaDLKuxe9lB5EDQbix7xRbaQJIOJd+S022vQrXHZ5Z1i8GciRaxmpcLtxuy9Vnm
BW5ZoY0DTimyIBvI4zCZHDhwbbLpYj6pF0XOXcaaNFeFisrHXxlQXMk5UJ/uLXeR
nkcW99EFO0LApDUOM4gZP+oc/puHXJXsTfi32N+Q/W7KE/DueDznIFMlCzpmYBdf
dtLIK3JKel0oEk8W9FzaajAL2QqXDDHkjCw=
-----END CERTIFICATE-----

请复制以下内容到conf\ca\github-pri.txt文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
-----BEGIN RSA PRIVATE KEY-----
MIIEpQIBAAKCAQEA0vhTezP4zI6zN53Pk0j3ftfkjGEsRxtAxQCfjXOsQb9OdvOW
6/u73qx3GwLwI/2Bs9m8zZqsEdbLmGsITSufgXy9UBwgqWNAGs7k1TFp9nEhOwmX
MGH3av2NfAJUuaTi81kvGx1FPV/GDWH0E/gfZ7fkH1gUYNQXs3gI/tvZ1kB6ibsz
eOWTlMXiTUJOkKKGygYwZkfpTZKDTTBrq7gsVhTus2sGdpcgWZRiB24eilwh9THE
j9vBCo6W40FT5fT0+8zKseIAacQcopvTCGPjpKKcQUMOyd4hmIfM1bwnAHjin79c
AXcPavwJucD94s55vxbWuqPp2rYFjSC+H5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q
e02QXrECgYEAmhICWulY7jXUfcveSUMexggw/gEG0UHRreRW+Z1UMWWUW+S5ZWMn
9t+MqIDz/R67LxTmDut1E6WuoHkiyxQDuXGMeM6bsz63XQcUl/n+E7gWHyZe+6B4
2ITajk9LVQOjrv4UbG8uYZ+3NQVw5odyI03lX5f8wbOlVAAuktHikxM=
-----END RSA PRIVATE KEY-----

Step3. 解压,进入conf目录下修改pixiv.conf文件加入

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
server {
  listen 443 ssl;
  server_name *.github.com;
  
  ssl_certificate ca/github.txt;
  ssl_certificate_key ca/github-pri.txt;
  
  location / {
        proxy_pass https://140.82.121.3;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header User-Agent $http_user_agent;
        proxy_set_header Accept-Encoding ''; 
        proxy_buffering off;
    }
}
server {
  listen 443 ssl;
  server_name *.githubusercontent.com;
  
  ssl_certificate ca/github.txt;
  ssl_certificate_key ca/github-pri.txt;
  
  location / {
        proxy_pass https://151.101.112.133;
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header User-Agent $http_user_agent;
        proxy_set_header Accept-Encoding ''; 
        proxy_buffering off;
    }
}

Step4. 最后在hosts文件中加入

1
2
3
4
5
127.0.0.1 gist.github.com
127.0.0.1 raw.githubusercontent.com
127.0.0.1 api.github.com
127.0.0.1 avatars.githubusercontent.com
127.0.0.1 camo.githubusercontent.com

你就能下载GitHub 的RAW了。

2.补充

如何手动信任证书.gif:

2.gif