配置Nginx和PgHero

时间:2019-01-23 03:52:18

标签: ssl nginx portforwarding

我的nginx配置如下:

server {
   listen 443 ssl;
   listen [::]:443 ssl;
   server_name *.domain.ai;

   ssl on;
   ssl_certificate /home/project/anaconda3/ssl/ssl-bundle.crt;
   ssl_certificate_key /home/project/anaconda3/ssl/server.key;
   ssl_prefer_server_ciphers on;

   location /static/ {
      root /home/user/project/;
   }

   location / {
      include proxy_params;
      proxy_pass http://unix:/run/gunicorn.sock;
      proxy_http_version 1.1;
      proxy_set_header Connection "";
      proxy_connect_timeout 600;
      proxy_read_timeout 600;
   }
}


server {
  listen 80;
  listen [::]:80;
  server_name *.domain.ai;

  location = /favicon.ico {access_log off; log_not_found off; }
  location /static/ {
    root /home/user/project/;
  }

  location / {
    include proxy_params;
    proxy_pass http://unix:/run/gunicorn.sock;
  }
  return 301 https://$host$request_uri;
}

PgHero在端口3001上运行。我已将该端口添加到两个服务器块中,但是nginx不会。错误为nginx: [emerg] bind() to 0.0.0.0:3001 failed (98: Address already in use)

我在Google上进行了搜索,但找不到有关如何进行设置的任何文档。我遵循了位于nginx and pghero处的示例配置,但不了解如何将所有流量从端口80(http)转发到端口443(https)的情况。我想使用https://sub.domain.com:3001之类的链接访问pghero。

0 个答案:

没有答案