New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
5 participants
@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

This comment has been minimized.

Copy link
Owner

aploium commented Oct 25, 2016

已加入readme, 非常感谢

@aploium aploium closed this Oct 25, 2016

@Alife

This comment has been minimized.

Copy link

Alife commented Jan 3, 2017

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

@YLaido

This comment has been minimized.

Copy link

YLaido commented Feb 22, 2017

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

@spin6lock

This comment has been minimized.

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 join this conversation on GitHub. Already have an account? Sign in to comment