This repository was archived by the owner on Jan 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
薛丞宏 edited this page Mar 5, 2017
·
23 revisions
參考:https://github.com/g0v/itaigi/issues/269#issuecomment-263864798
- forever list
- forever restart 需要swap,因為node需要1g以上
主機是 linode 10 USD/month 的,目前還沒上production
-
itaigi folder path: /home/ubuntu/itaigi
-
nginx + gunicorn
-
nginx: /etc/nginx/sites-enabled/default
-
gunicorn: /home/ubuntu/itaigi/server-side/guni/guni.sh
-
celery: /home/ubuntu/itaigi/server-side/guni/celery.sh
-
celery-beat: /home/ubuntu/itaigi/server-side/guni/celery-beat.sh
-
supervisor: /etc/supervisor/conf.d/guni.conf
-
log: /home/ubuntu/itaigi/server-side/log/
-
重啟所有服務:sudo supervisorctl reload
-
服務狀態:sudo supervisorctl status
-
重啟特定服務:sudo supervisorctl web:guni、sudo supervisorctl mq:celery、sudo supervisorctl cron:celery-beat
逐家快取一點鐘,除了/平臺項目列表/揣無建議的外語
一分鐘
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_use_stale
proxy_cache my_cache;
add_header X-Cache-Status $upstream_cache_status;
proxy_hide_header 'Access-Control-Allow-Origin';
add_header 'Access-Control-Allow-Origin' $http_origin;
proxy_cache_use_stale updating;
設定swap
(venv) root@itaigi-hts:~/hok8-bu7# cd /
(venv) root@itaigi-hts:/# dd if=/dev/zero of=/swap1G bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 3.01494 s, 356 MB/s
(venv) root@itaigi-hts:/# chmod 600 swap1G
(venv) root@itaigi-hts:/# mkswap swap1G
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)
no label, UUID=ce72ea08-7f55-4d4d-8ea5-6819dfbc1bb0
(venv) root@itaigi-hts:/# vim /etc/fstab
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:20m max_size=10g
inactive=30d use_temp_path=off;
location / {
...
expires 30d;
proxy_cache my_cache;
proxy_cache_valid 200 10m;
add_header X-Cache-Status $upstream_cache_status;
參考: