Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

尝试在 nginx 环境下部署了 zmirror. #36

Closed
phuslu opened this issue Oct 25, 2016 · 4 comments
Closed

尝试在 nginx 环境下部署了 zmirror. #36

phuslu opened this issue Oct 25, 2016 · 4 comments

Comments

@phuslu
Copy link

phuslu commented Oct 25, 2016

操作系统: Ubuntu 16.04 LTS
前置要求: 已经安装了 nginx 并配置了域名和 SSL 证书。

安装的命令:

# 安装系统必须的 python 环境
sudo apt install python-virtaulenv python-dev python-pip
# 克隆 zmirror 到 /opt 目录
git clone https://github.com/aploium/zmirror /opt/zmirror
cd /opt/zmirror
# 创建 virtualenv
virtualenv -p python3 venv
# 安装 gunicron
./venv/bin/pip install -i https://pypi.douban.com/simple gunicorn gevent
# 安装 zmirror 自身依赖
./venv/bin/pip install -i https://pypi.douban.com/simple -r requirements.txt
# 编辑 config.py
cp more_configs/config_google_and_zhwikipedia.py config.py
echo -e  '\nverbose_level = 1' >config.py
sed -ir 's/my_host_name =.+/my_host_name = "你的域名"/g' config.py
# 启动 zmirror 服务器
./venv/bin/gunicorn --daemon --capture-output --log-file zmirror.log --access-logfile zmirror-access.log --bind 127.0.0.1:8001 --workers 2 --worker-connections 100 wsgi:application

好了,这样 zmirror 已经在本地 8001 HTTP 端口跑起来了,接下里就可以编辑 nginx.conf 转发给它了。这个就不再赘述。

aploium added a commit that referenced this issue Oct 25, 2016
aploium added a commit that referenced this issue Oct 25, 2016
@aploium
Copy link
Owner

aploium commented Oct 25, 2016

已加入readme, 非常感谢

@aploium aploium closed this as completed Oct 25, 2016
@Alife
Copy link

Alife commented Jan 3, 2017

最后一行应该是./venv/bin/gunicorn

@YLaido
Copy link

YLaido commented Feb 22, 2017

感谢教程,不过本人DO测试了下还是得先配置nginx的端口转发才可连接,另外不知为何一搜索一定会有验证码并且码图片刷不出。。working on it

@spin6lock
Copy link

spin6lock commented Nov 30, 2017

感谢,下面提供一份nginx.conf的参考配置

server {
        listen 443;
        server_name your.domain.com;


        access_log            /var/log/nginx/your.access.log;

        location / {
        include            uwsgi_params;
        uwsgi_pass         uwsgicluster;

        proxy_redirect     off;
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Host $server_name;
        }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants