这是我第一次使用nginx。我试图简单地将流量从端口 80 转发到 127.0.0.1:8080,我在其中运行了一个 Vapor 服务器。我已经在网上搜索了 nginx 的配置,但还没有找到解决方案。我用的是mac服务器。请帮忙。这就是我目前的配置:
server {
listen 80;
server_name 192.30.133.70;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_cache_bypass $http_upgrade;
}
还有:
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
据我所知,造成差异的更改是服务器名称。 nginx 和我的 Vapor 服务器运行得非常神奇。这就是 server_name 现在的样子:
服务器名称_;