Skip to content

Cấu hình nginx

Vu Anh edited this page Apr 23, 2019 · 1 revision

Server hiện tại đang dùng: Django + Gunicorn + Nginx

Để public chatbot, cần cấu hình nginx

Bước 1: Copy file cấu hình nginx

cd chatbot
cp config/chatbot.nginx.config /etc/nginx/sites-enabled/chatbot
ln -s /etc/nginx/sites-available/chatbot /etc/nginx/sites-enabled/chatbot

Bước 2: Sửa cấu hình nginx trong file config

$ vim etc/nginx/sites-available/chatbot

Nội dung cấu hình nginx

upstream chatbot_server {
  server 127.0.0.1:8001 fail_timeout=0;
}

server {
  listen 8000 default_server;
  return 444;
}

server {
  listen 8000;
  server_name undertheseanlp.com; # change to your own domain name

  location = /favicon.ico { access_log off; log_not_found off; }
  location / {
    root /;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host:$server_port ;
    proxy_set_header X-Forwarded-Server $host ;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;

    proxy_pass http://chatbot_server;
  }
}

Sửa dòng server_name undertheseanlp.com thành domain của bạn

Bước 3: Khởi động nginx

$ service nginx reload
 * Reloading nginx configuration nginx
   ...done.

Kiểm tra trạng thái của nginx

$ service nginx status 
* nginx is running
Clone this wiki locally