Change listening port on NGINX

Hello,
I have configured the listening port of my NGINX server on DietPI.

This is my configuration after change, the new port listening is 8080.

#D I E T - P I
# /etc/nginx/sites-available/default

server {

        listen 8080 default_server;
        listen [::]:8080 default_server;

        root /var/www;
        index index.php index.html index.htm;

        server_name "$hostname";

        location / {
                try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /var/www;
        }

        location ~ \.php(?:$|/) {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_param PATH_INFO $fastcgi_path_info;
                fastcgi_pass php;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include fastcgi_params;
        }

        include /etc/nginx/sites-dietpi/*.conf;

}

The problem is that the web server continue to listening on port 80, in fact when I do not specify the port on my browser I will see the default web page of the web server.
I want that this server listens only on port 8080.

Thanks
FedericoCoppola

FedericoCoppola
Sorry for asking, but you restarted webserver and PHP?

systemctl restart nginx
systemctl restart php7.0-fpm

Thanks! :slight_smile: