We'll create a separate NGINX configuration file with the server block in it, as follows:
server { listen 80; server_name beegodemo.nginxcookbook.com; access_log /var/log/nginx/beegodemo-access.log combined; location = /favicon.ico { access_log off; log_not_found off; } location / { proxy_pass http://127.0.0.1:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
By default, a Beego application will listen on the localhost to port 8080. We simply proxy all connections though. Like the Express recipe, we also set the proxy headers to allow WebSockets to pass through as well.