Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Q&A
Cloudflare, IIS, Nginx
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="airilxx" data-source="post: 480884" data-attributes="member: 10908"><p>You should be able to run both Nginx and IIS instance in a same server, just need to listen Nginx on different port.</p><p></p><p>For instance, IIS would run on port 80 to serve website, client and game assets. Nginx will function as a reverse-proxy to allow websocket connection from nitro client <-> emulator.</p><p></p><p>Let's say on your emulator and nitro client, you're listening on port 2096 for websocket connections. You may create a config file for Nginx which listens on different port, lets say 2087 and forward it up to your existing port, which is 2096. which it would be like this:</p><p></p><p>nitro client <-> Nginx <-> emulator</p><p></p><p>Which completely eliminates the need of Cloudflare proxies that will randomly disconnects users on specific occasions.</p><p></p><p>However to achieve this, you would need an SSL for the websocket domain, as it will be fully handled by Nginx independently. Easy way is to obtain free SSL certificate from Lets Encrypt, you can achieve this by using Certbot (<a href="https://certbot.eff.org/" target="_blank">https://certbot.eff.org/</a>)</p><p></p><p>Once you've obtained your free SSL certificate, you'll need to adjust Nginx config to allow websocket proxy. Here is a reference for the guide on creating websocket proxy config (<a href="https://www.nginx.com/blog/websocket-nginx/" target="_blank">https://www.nginx.com/blog/websocket-nginx/</a>)</p><p>Here is a config example:</p><p>[CODE]worker_processes 1;</p><p></p><p>events {</p><p> worker_connections 1024;</p><p>}</p><p></p><p>http {</p><p> include mime.types;</p><p> default_type application/octet-stream;</p><p></p><p> sendfile on;</p><p> keepalive_timeout 65;</p><p></p><p> # WebSocket</p><p> server {</p><p> listen 2087 ssl;</p><p> server_name ws.domain.com;</p><p> </p><p> location / {</p><p> proxy_pass http://127.0.0.1:2096;</p><p> proxy_http_version 1.1;</p><p> proxy_set_header Upgrade $http_upgrade;</p><p> proxy_set_header Connection 'upgrade';</p><p> proxy_cache_bypass $http_upgrade;</p><p> }</p><p> </p><p> # SSL Config</p><p> ssl_certificate C:/Certbot/live/ws.domain.com/fullchain.pem; # managed by Certbot</p><p> ssl_certificate_key C:/Certbot/live/ws.domain.com/privkey.pem; # managed by Certbot</p><p> }</p><p>}</p><p>[/CODE]</p><p></p><p></p><p>Lastly on Cloudflare, you will need to disable the proxy for the websocket domain (the orange cloud) on DNS records, and also you will need to adjust page rule for the websocket domain by settting SSL to Full.</p><p></p><p>Once all is done, you will need to create a script to start Nginx server manually, or on each server startup.</p><p></p><p>These are the default setup that I've personally used years ago, as I've hosted IIS and Nginx on same machine due to best server resources we've had. Someone might come with better solutions nowadays.</p><p></p><p>However I would recommend that you use separate server to host the Nginx proxy to avoid future issue, unless your current VPS has good protections.</p></blockquote><p></p>
[QUOTE="airilxx, post: 480884, member: 10908"] You should be able to run both Nginx and IIS instance in a same server, just need to listen Nginx on different port. For instance, IIS would run on port 80 to serve website, client and game assets. Nginx will function as a reverse-proxy to allow websocket connection from nitro client <-> emulator. Let's say on your emulator and nitro client, you're listening on port 2096 for websocket connections. You may create a config file for Nginx which listens on different port, lets say 2087 and forward it up to your existing port, which is 2096. which it would be like this: nitro client <-> Nginx <-> emulator Which completely eliminates the need of Cloudflare proxies that will randomly disconnects users on specific occasions. However to achieve this, you would need an SSL for the websocket domain, as it will be fully handled by Nginx independently. Easy way is to obtain free SSL certificate from Lets Encrypt, you can achieve this by using Certbot ([URL]https://certbot.eff.org/[/URL]) Once you've obtained your free SSL certificate, you'll need to adjust Nginx config to allow websocket proxy. Here is a reference for the guide on creating websocket proxy config ([URL]https://www.nginx.com/blog/websocket-nginx/[/URL]) Here is a config example: [CODE]worker_processes 1; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; # WebSocket server { listen 2087 ssl; server_name ws.domain.com; location / { proxy_pass http://127.0.0.1:2096; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_cache_bypass $http_upgrade; } # SSL Config ssl_certificate C:/Certbot/live/ws.domain.com/fullchain.pem; # managed by Certbot ssl_certificate_key C:/Certbot/live/ws.domain.com/privkey.pem; # managed by Certbot } } [/CODE] Lastly on Cloudflare, you will need to disable the proxy for the websocket domain (the orange cloud) on DNS records, and also you will need to adjust page rule for the websocket domain by settting SSL to Full. Once all is done, you will need to create a script to start Nginx server manually, or on each server startup. These are the default setup that I've personally used years ago, as I've hosted IIS and Nginx on same machine due to best server resources we've had. Someone might come with better solutions nowadays. However I would recommend that you use separate server to host the Nginx proxy to avoid future issue, unless your current VPS has good protections. [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Q&A
Cloudflare, IIS, Nginx
Top