Is it possible to make Nginx listen to different ports?

Solution 1:

You can also do the following:

server {
    listen 80;
    listen 8000;
    server_name example.org;
    root /var/www/;
}

Solution 2:

Yes, it is.

What you probably want is multiple "server" stanzas, each with a different port, but possibly (probably?) the same server_name, serving the "different" content appropriately within each one, maybe with a different document root in each server.

Full documentation is here: http://nginx.org/en/docs/http/server_names.html

Example:

server {
    listen       80;
    server_name  example.org  www.example.org;
    root         /var/www/port80/
}

server {
    listen       81;
    server_name  example.org  www.example.org;
    root         /var/www/port81/
}