david euler 166df7d46b minor change | 6 лет назад | |
---|---|---|
templates | 6 лет назад | |
.gitignore | 6 лет назад | |
README.md | 6 лет назад | |
config.py | 6 лет назад | |
dump.sh | 6 лет назад | |
gunicorn.sh | 6 лет назад | |
links_title_dumper.py | 6 лет назад | |
requirements.txt | 6 лет назад | |
service.py | 6 лет назад | |
test.txt | 6 лет назад | |
url_util.py | 6 лет назад | |
wsgi.py | 6 лет назад |
1.URL对应的Title描述从网站的HTML内容中检索a标签得到; 输入是一个 <URL, Title> 列表
2.如果没有对应的Title,则根据URL后面的路径文件名从搜索引擎检索。
python links_title_dumper.py > links_json.py
location / {
try_files $uri $uri/ /index.php?$args @fetch;
}
location @fetch {
# 放错误页面的目录路径。
proxy_pass http://127.0.0.1:5000;
}
如上的配置,真实的URL不能正确传递到Flask服务端。 正确的配置:
location /{
autoindex off;
try_files $uri $uri/ @fetch;
}
# 定义错误页面码,如果出现相应的错误页面码,转发到那里。
error_page 404 403 = @fetch;
location @fetch {
# Redefine the header fields that NGINX sends to the upstream server
#the name and port of the NGINX server (Host $host)
proxy_set_header Host $host;
#the schema of the original client request, as in whether it was an http or an https request:
proxy_set_header X-Forwarded-Proto $scheme;
#the IP address of the user (X-Real-IP $remote_addr)
proxy_set_header X-Real-IP $remote_addr;
#the IP addresses of every server the client has been proxied through up to this point:
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Define the maximum file size on file uploads
client_max_body_size 5M;
# 放错误页面的目录路径。
proxy_pass http://127.0.0.1:5000;
}