@kpatrick
2019-06-27T09:39:54.000000Z
字数 758
阅读 68
work linux
打开nginx配置(正常情况下需要root权限)
$ vim /etc/nginx/sites-enabled/default
server {# 转发的端口配置listen 38001 ssl;# Make site accessible from http://localhost/server_name ai.urundata.com.cn;ssl_certificate cert/a.crt;ssl_certificate_key cert/a.key;ssl_session_timeout 5m;ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_protocols TLSv1 TLSv1.1 TLSv1.2;ssl_prefer_server_ciphers on;…………}
添加个人映射
将localhost:38001/api/text_translate
映射到127.0.0.1:8800/translate/
location /api/text_translate {proxy_pass http://127.0.0.1:8800/translate/;}
$ sudo nginx -s reload
curl 测试一下有无 response:
$ curl https://ai.urundata.com.cn:38001/api/text_translate -X POST -d "to_lang=zh&input_text=hello"
{"status": "ok", "data": [{"output_text": "\u4f60\u597d"}]}
