Block a specific port in Nginx
<p>I have the following config:</p>

<pre><code>server {
    listen 80;

    server_name my_server.com;

    location / {
        proxy_pass http://localhost:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
   }
}
</code></pre>

<p>The application is run on port 8080. How can I block this port? I mean when some user opens <a href="http://my_server.com:8080" rel="nofollow">http://my_server.com:8080</a> then server sends no response.</p>

<p>Thank you!</p>