Using node.js to listen on 2 different ports

Just create another instance of http and put it to listen to the port you are interested. Let me show you an example: var http = require(‘http’); http.createServer(onRequest_a).listen(9011); http.createServer(onRequest_b).listen(9012); function onRequest_a (req, res) { res.write(‘Response from 9011\n’); res.end(); } function onRequest_b (req, res) { res.write(‘Response from 9012\n’); res.end(); } Then, you can test it (with … Read more

Really logging the POST request body (instead of “-“) with nginx

Nginx doesn’t parse the client request body unless it really needs to, so it usually does not fill the $request_body variable. The exceptions are when: it sends the request to a proxy, or a fastcgi server. So you really need to either add the proxy_pass or fastcgi_pass directives to your block. The easiest way is … Read more

How to serve other vhosts next to Gitlab Omnibus server? [Full step-by-step solution]

About these But Omnibus listen 80 and doesn’t seem to use neither Apache2 or Nginx [, thus …]. and @stdob comment : Did omnibus not use nginx as a web server ??? – Wich I responded I guess not because nginx package isn’t installed in the system … In facts From Gitlab official docs : … Read more

How do you scale HTTP server like Google?

google.com, update.microsoft.com, and other services which handle astonishingly high aggregate bandwidth do much of their magic via DNS. BGP Anycast routing is used to announce the IP address of their DNS servers from multiple points around the world. Each DNS server is configured to resolve google.com to IP addresses within a data center which is … Read more

Access a web server which is running on WSL (Windows Subsystem for Linux) from the local network

None of the existing answers work for me, as WSL2 is running in its own VM and has its own network adapter. You need some sort of bridge or port forwarding for non-localhost requests to work (i.e. from another host on the same network). I found a script in https://github.com/microsoft/WSL/issues/4150 that worked to resolve the … Read more

How can I automatically redirect HTTP to HTTPS on Apache servers?

I have actually followed this example and it worked for me 🙂 NameVirtualHost *:80 <VirtualHost *:80> ServerName mysite.example.com Redirect permanent / https://mysite.example.com/ </VirtualHost> <VirtualHost _default_:443> ServerName mysite.example.com DocumentRoot /usr/local/apache2/htdocs SSLEngine On # etc… </VirtualHost> Then do: /etc/init.d/httpd restart

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)